Technology Castle
E-Learning
Variables
In javaScript variables are containers that store data values. Similar to place holders . There are global and local variables. But we will discuss between them later.
To give a variable a value, you want to use the reserve tag var, variable identifier car use the equal sign as an assignment operator (-), set it or give it a/the value bentley(for this example), and close the statement with a semi-colon(;).
i.e.
var |car| =| Bentley Coupe;
var tag| variable identifier |assignamnet operator | value ;
Naming variables are case sensitive, and camel casing is most commonly used in the coding and scripting community.
Variables must start with a letter, underscore or dollar sign x, _ , $.
Variable identifiers can be short like x or y or more descriptive like age, sum, or carColor.
variables CAN NOT! start with a number.