Computer >> Computer tutorials >  >> Programming >> Javascript

What are primitive data types in JavaScript?


Datatypes hold different values. There are two types of datatypes in JavaScript: Primitive and Non-Primitive. Primitive defines immutable values and was introduced recently by ECMAScript standard.

Primitive datatypes include the following:

String 

As the name suggests, the string is for a sequence of characters, for example, “demo”, “Hi”, etc. 

Boolean 

It has two values i.e True or False.

Number 

Number represents numerical values such as 5, 20, 500, etc.

Undefined

Undefined value

Null 

Null value

Symbol 

New datatype introduced in ECMAScript 6.