DEV Community


What are the different datatypes in Javascript?

srijan82239366 profile image Srijan Originally published at ・1 min read

This post first appeared on

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

Discussion (0)

Editor guide