Variables
A variable is used hold value or expression and can be accessed at a later time.
Keyword:
The keyword for declaring a variable is var.
Rules:
Variable names are case sensitive i.e. a and A are two different variables.
Variable names must begin with a letter or the underscore character.
Declaring a variable:
var a;
The varibale a is declared, but is not given a value yet, this can be done later in the script.
var b = 18;
The variable b is declared and is given the value 18.
|