Variables and Declarations
What is Variable?
Noteworthy:
· Variable stores a single data value that can be changed later.
· Variables can be defined using var keyword. Variables defined without var keyword become global variables.
· Variables must be initialized before using.
· Multiple variables can be defined in a single line. e.g. var one = 1, two = 2, three = "three";
· Variables in JavaScript are loosely-typed variables. It can store value of any data type throughout its life time.
Syntax:
var <variable-name>;
var <variable-name> = <value>;
Source code:
var a=10
console.log(a)
Output:
10
Thank you, Come Back to Learn More About Tech Stuff with Tech Bird
Have A Nice Day !
:)
Comments