JavaScript variables are boxes or memory for saving data values.  

var x = 50;
var y = 60;
var z = x + y;

x, y, and z are variables, told I am storing values with the var keyword:

  • x stores the value 50
  • y stores the value 60
  • z stores the value 110

Another example

var Name = "Rathorji";
var myAge = 22;


JavaScript Variables

  • variables must be named with unique names.
  • the unique name is called an identifier.
  • the identifier can contain letters, digits, underscores, and dollar signs.
  • the identifier must begin with a letter
  • the identifier can also begin with $ and _ (but we will not use it in this tutorial)
  • the identifier is case sensitive (y and Y are different variables)