Variables

Learn about the properties of a variable and how to declare it in JavaScript.

Role of a variable

A computer program stores data using variables. A variable is an information storage area. We can imagine it as a box in which you can put and store things!

Variable properties

A variable has three main properties:

  • Its name, which identifies it. A variable name may contain upper and lower case letters, numbers (not in the first position), and characters like the dollar sign ($) or underscore (_).
  • Its value, which is the data stored in the variable.
  • Its type, which determines the role and actions available to the variable.

You don’t have to define a variable ...

Access this course and 1400+ top-rated courses and projects.