Variables

In this lesson, we will learn about JavaScript variables and how to use them. Let's begin! :)

As you learned earlier, JavaScript supports objects that can have dynamic properties, and so they can be used to represent compound things.

JavaScript also supports primitive or simple value types that store irreducible values such as numbers, strings, and Boolean flags. In this section, you will learn more about these values and types.

Variable assignment #

To store either simple values or objects, you must assign them to variables:

Press + to interact
var obj = new Object();
obj.name = "Dave";
var number = 42;
var regExp = /(bat)?man/;

Here, obj and regExp ...