JS Variables or Java script Variables
A variable is a symbolic name associated with a value. Variable uses “var” to define.
Ex
1 2 3 4 5 6 7 8 9 |
<script type="text/javascript"> var abcde; // abcde is a variable var abc888; //abc888 is a variable var my_variable; //my_variable is a variable </script> |
Explanation:
abcde, abc888 and my_variable are all variables.
They can store some value. e.g.
var abcde=100;
var abc888=”Hello World”;
var my_variable=true;
Notice that variable naming cannot start with numbers, cannot have spaces. e.g. “23var”, “abc de” are invalid variable names.
But “var23”, “abcde” are valid variable names.