JavaScript Output Functions

Javascript in Hindi – Js Output Functions In Hindi

JavaScript

Javascript Output in HindiJs Output Functions In Hindi – Is Output Functions Ki Help Se Ham Display Output Karna Sikhne Wale Hai And Types Of Js Output Functions in Hindi Ke Bare Mai Ek Ek Point Ko Karne Wale Hain.

Yadi Aapne  HTML Full Course  And CSS Full Course And Python Full Course And PHP Full Course Nhi Read Kiya Hai To Aap Vah Bhi Read Kar Sakte Hai |

Js Output Functions In Hindi

Javascript Code ko run karane ke tarike hai. Jinke madhyam se javascript Code ka Output milta hai. Yaha pe ham un sabhi Functions or Element ke bare me janege. Jisse Javascript Code Hame Output deta hai.

Also Read:- JavaScript Introduction     

Types Of Js Output Functions in Hindi

Waise Javascript Output Functions Ko 4 Types Mai Divide Kiya Gaya Hai Jo Output Show Karne Ke Liye AlagAlag Tarike Istemal Karte Hai |

  • Document.write()
  • console.log()
  • window.alert()
  • innerHTML

Document.write()

Ye Javascript ka Text print karvane ka Simple function hai. Iske dwara kaphi aasani se javascript ka output display kara sakte hai. Chaliye jante hai. Isko kaise Use kiya jata hai.

Example:

<script>
document.write("hello world");
</script>

Yaha pe ek hello world javascript program create kiya hai. Jo Hello world screen pe output deta hai.

Output:

Hello World
  1. Javascript ko html me use karne ke liye <script> </script> tag me javascript code likhte hai.
  2. isame document file define karta hai. or write document me javascript code likhta hai. Or display karata hai.
  3. Jo text hame print karana hota hai. Usko is function me (“”) Quatation mark ke andar likhte hai. document.write(hello world)
  4. Javascript ke pratyek statement ke baad me ( 😉 semicolon lagaya jata hai. document.write(“hello world”);

Console.log()

Is javascript function ki Help se Console me kuch bhi print kara sakte hai. Example – Text, Variable Iski Help se koi bhi variable print kara sakte hai. Jiski user ko Argent Mai Output Ki Jarurat hai.

<script> 
var a = 2; 
var b = 3;
console.log(a+b); 
</script> 

Isme dekh sakte hai. Hamne ek simple calculation ki hai. Or iska Output console me display kara rahe hai.

Output:

5

window.alert()

Iski madad se javascript output alert box me display kara sakte hai. Isme window ek Optional document hai. Agar ham chahe to iske bina bhi isko run kar sakte hai.

<script> 
var a = 2; 
var b = 3;
window.alert(a+b); 
</script> 

InnerHTML

JavaScript me InnerHTML property Document Object Model (DOM) ka ek part hai. Jiske madhyam se kisi bhi HTML element ko Change Manipulate kar sakte hai. iske dwara usme Functionality add kar sakte hai. Chaliye sabse pahle ek iska program create karte hai. Phir samajhate hai.

<!DOCTYPE html>
<html>
<body>
<p id="demo">Hello World!</p>
<script>
document.getElementById("demo").innerHTML = "New text!";
</script>
</body>
</html>

1.  Isme dekhiye ek paragraph create Kiya hai. Jisme Text hello world hai. Aur iski I’d demo hai. 

2. Ab hamko JavaScript ke madhyam se is text ko change hai. 

3. To JavaScript me sabse pahle is element ko access karege. 

4. Isko Access Karne ke liye “document.getElementByID” method ka use kar rahe hai. 

5. Change Karne ke liye document.getElementByID(“demo”). InnerHTML ka use kar rahe hai. 

6. Uske baad = lagakar “” quatation me new text likh dege phir semicolon laga dege. document.getElementByID(“demo”).innerHTML = “new text!”;

To ab aap Javascript Output ko puri tarah samajh chuke hai.

Output:

New text!

Also Read:- JS Setup And Installation

Leave a Reply

Your email address will not be published. Required fields are marked *