Datatypes in the JavaScript

Ranuj Mahajan
1 min readJan 7, 2021

Note: Primitive Datatypes has no method of its own. They are immutable. primitive types are not Objects. Don't confuse them with Constructors used in the JavaScript like Number(3) and Boolean(True).

There are 6 primitive datatypes present in the JavaScript .

  1. Boolean: True or False
  2. Null: it is no value.
  3. undefined: this is a variable which has been declared and but it has no value and “typeof undefined” is undefined.
  4. Number: they are number . they can be integers, float.
  5. String: an array of characters is string: they make sentences in javascript
  6. Symbol: this is the unique id . typeof Symbol() is “symbol”

Everything else in JavaScript is an object . for Example

  1. Array:[]
  2. Object : {}
  3. Number(3)
  4. Error
  5. Math

these are objects present in the JavaScript and you can make your own objects in the JavaScript through constructor function .

code examples for the primitive datatypes

--

--

Ranuj Mahajan

I am curious mind. i am very simple human being in this complicated consiousness. i try to explain concepts of computers and life in simple and precise manner.