In JavaScript, you can create different types of information or data such as a phone number, your name, or even a list of your favorite football players. Different types of these data that JavaScript or any other programming language offers can be called data-types.
Consider the following example:
In the example given above,
we are assigning a value "Hello World"
to a variable named wish
.
This value that
consists of a bunch of characters
inside double quotes
is known as the String data type.
Similarly, Number is also
a data type supported by JavaScript:
These data types can be divided into two main categories: Primitive and Non-primitive.
Primitive Data Types
Primitive data types are the built-in data types provided by JavaScript. They represent single values and are not mutable, such as Number, String and Boolean.
Non-primitive Data Types
Non-primitive data types, also known as reference types, are objects and derived data types. They can store collections of values or more complex entities, such as Object and Array.