June 1999
Intermediate to advanced
540 pages
21h 39m
English
Variables are declared, and optionally initialized, with the var
statement:
var i; var j = 1+2+3; var k,l,m,n; var x = 3, message = 'hello world';
Variable declarations in top-level JavaScript code may be omitted, but they are required to declare local variables within the body of a function.
JavaScript variables are untyped: they can contain values of any data type.
Global variables in JavaScript are implemented as properties of a special global object. Local variables within functions are implemented as properties of the Argument object for that function.
Read now
Unlock full access