What are different types of datatypes in Javascript?

javascript

The data types in javascript can be divided as Primitive and Object.

Primitive Data Types:

In Javascript, all values except Objects are defined as immutable values (values that cannot be changed or modified). There is a total of 6 primitive types defined by the latest ECMAScript standard:

  1. boolean
  2. null
  3. undefined
  4. number
  5. string
  6. symbol(new in ECMAScript 2015)

Object Data Type:

Object type refers to a compound value that can be seen as a collection of properties. Properties are key/value pairs. Keys are strings (or Symbols) and values can be of any type, including other objects.

var obj = {
  name: 'Cheese Burger',
  cost: 5,
  extra_cheese: true
};

Related Article: Javascript Data Types Explained

Share and support us

Share on social media and help us reach more people