JavaScript 001 – Declare Variable

In JavaScript, you can declare a variable using the var keyword. This tells the system to reserve some memory for future use. After declaring the variable, we can store a value in it. For example:
var MyVar;
Myvar = 12;
In the above snippet, we declare a variable called MyVar using the keyword var. In the next line, we store a value of 12 into the variable MyVar. The = sign denotes the assignment. Means. It tells value 12 is assigned to the variable MyVar. Note, JavaScript is case sensitive and when you read the back the value you have to use the same variable name with the same case.