are containers for storing data values. They can be used in expressions.
statement declares a variable
, optionally initializing it to a value.
names can contain letters, digits and underscores. Digits cannot be the first character in the name of a variable
. The same rules apply to functions
The current data types are: number
The undefined and null data types are special in that they can have only one value.
Undefined variables have been declared but have not been assigned a value.
A variable can be explicitly emptied of its current contents by assigning it the null value.
Default Value: undefined
var x = 5
var y = 6
var z = x + y
var string = 'example'
From the example above, you can expect:
x stores the value 5 as a number data type
y stores the value 6 as a number data type
z stores the value 11 as a number data type
string stores the value example as a string data type
example stores the value undefined as an undefined data type