Data Types

Variables can hold different values and these values can be broken down into different categories known as Data Types. In JavaScript, data types are divided into two categories Primitive Data Types and Objects.

Primitives

Primitives define immutable values or a value that cannot be changed. This means the specific value cannot change, not the variable holding that value. For example, the value of the Number 2 is always 2, you cannot change that. Likewise, the String of characters ABC cannot be changed.

In JavaScript, there are six primitive data types, which are as follows:

From this list, the three most common data types are Boolean, Number, and String.

Objects

In JavaScript, an object is considered to be a collection of properties. These properties are stored in key-value pairs. The key is used to identified properties, and values can be a value of any type.

Any data structure that is not a primitive data type is an object including:

We will learn more about these data types later in the course.

See Also