JavaScript Data Types


JavaScript data type indicates the characteristics of data and it tells the compiler about the type of data a variable is having.

JavaScript is a dynamic/loosely type language, i.e. we don’t need to specify the type of variable during declaration because a same variable can be used to hold different data types.

There are two types of data types in JavaScript,

1. Primitive data type

2. Non-primitive (reference) data type


Primitive Data Type

A primitive data value is a single simple data value with no additional properties and methods.

Data Type Description
String It represents a series of characters. It is written within quotes. Ex: “Tutorials” , ‘Duniya’
Number It represents all numeric values. Ex: 70 , 25.2
Boolean It represents either true or false.
Null It represents a null i.e. no value.
Undefined It represents an undefined value.


Non-Primitive Data Type

A non-primitive data value is a complex data value with additional properties and methods.

Data Type Description
Object It represents an instance through which we can access members. It’s properties are written as name:value pairs, separated by commas.
Array It represents a group of similar values.
RegExp It represents a regular expression.