1.

Explain how a variable is declaring in JavaScript.

Answer»

For storing values you have to declare a variable, for that the keyword var is used. There is no need to specify the data type.

Syntax: 

var <variable name1> [,<variable name2> ,<variable name3> ,etc…] 

Here square bracket indicates optional. 

Eg: var x, y, z; 

x= 11; 

y = ”BVM”; 

z = false; 

Here x is of number type, y is of string and z is of Boolean type.



Discussion

No Comment Found