In programming, a variable is a value that can be changed. All variables will have a storage location and a name. The variable name is usually used to refer to the value that is stored in a variable.
Assigning a value
A value is assigned to a variable using the = operator.
Things to remember
- An uninitialized variable variable will have the value undefined.
- A variable will not lose it’s value if it is declared again.
- Never use quotes for storing a numerical value.
Numbers as strings
If you put any numbers in quotes, the remaining numbers will be treated as a string.
The value of a is: 105 and the value of b is: 73