Tag Archives: JavaScript Variables

What are JavaScript variables and what are they used for

What is a JavaScript variable?

A variable represents or hold a value.

Let’s consider the very commonly use example x = 2. The name of the variable would be x and its value would be 2. The value of a variable can be changed at any given time simply by giving x a new assignment. For example x = 4.

Consider the following math problem:

If x = 2, then 3 + x = ?

Continue reading