डिप्लोमा इन ऑफिस मैनेजमेंट एण्ड अकाउटिंग

डिप्लोमा इन ऑफिस मैनेजमेंट एण्ड अकाउटिंग

Full Stack Web Development with Laravel

Full Stack Web Development with Laravel

Affiliate Program

Affiliate Program

java script variable tutorial

Variable in java script

Declare a variable

use var keyword to declare a variable, var allow to redeclare a variable.
var x;

Initialisation of variable

x=100;

Print a variable

using document.write()
 
document.write(x)
 
using console.log()
console.log(x)

Multiple variable declaration

var x, y, z;

Multiple initialisation

x=y=z=100;

Concat variable with a string

document.write("x="+x);
 
Note: document.write() does not allow multiple statements without concat.
 

use of backtick (``)

document.write(`x=${x}`);
© 2016 - 2023, All Rights are Reserved.