September 2015
Intermediate to advanced
92 pages
1h 30m
English
CHAPTER 2
![]()
Variables
Variables are containers used for storing data, such as numbers or strings, so that they can be used multiple times in a script.
Declaring Variables
To create a variable the var keyword is used followed by a name, called the identifier. A common naming convention for variables is to have each word initially capitalized, except for the first one.
var myVar;
A value can be assigned to a variable by using the equals sign, which is called the assignment operator (=). This is called assigning or initializing the variable.
myVar = 10;
The declaration and assignment can be combined into a single statement. When a variable is assigned ...
Read now
Unlock full access