Variables are containers used to store values.
They are declared (made) with the keyword var : var myVar; The name myVar points now at the empty container .
A value is assigned to the variable with the operator = , var myVar = "Hinemoa";.The value is now stored in the container.
The name of the variable has to be a unique identifier so we can find the right container and retrieve the value.
The rules for variable names are:
start with: a letter, _ or $.
can contain: letters, _ or $ and numbers.
case sensitive: myVar is not the same name as myvar.
Variable names can be used in operations : x=3 y=7 z = x + y
Existing Variables can change data types: var X=new specialObj('John',21) ; X = 'hello'. X now contains the String 'hello'.
The container with the specialObj() still exist, but can't be retrieved and will be collected by the garbage collector.
declare assigncreate unique identifier that points at the variable container and store value