Back to home

Introduction to Variables

A variable is similar to a container that can be used to store data (values).

In JavaScript we use variables to store data values.

Example:


Declaring a Variable

var a;

var b;

var c;


Initializing a variable:

var a = 10;

var b = 5;

var c = 11;


In our example var a stores the value 10, var b stores the value 5, and var c stores the value 11.

Note: It is important to note that the equal sign " = " in JavaScript is considered to be as an assignment operator. We are assigning a value to our variable. In our example, we assign a value of 10 to the variable " a " using the " = " equal sign.

HERE's OUR FIRST CHALLENGE