Data Types in JavaScript

Open Source
Ashutosh Anand Tiwari's profile picture
Ashutosh Anand TiwariFollow
Share this article
Share
Data Types in JavaScript

Interviewer : Tell me all data types in JavaScript?

You: There are total 8 built in data types in JavaScript.

  1. string
  2. number
  3. boolean
  4. null
  5. undefined
  6. object
  7. symbol ( ES6 feature)
  8. bigInt

typeof Operator

JavaScripts Provides typeof operator to check the value and its type

var a;

typeof a; // undefined ( because there is no value in it)

a ='JS Snippets'
typeof a; // string

a=23;
typeof a; // number

a= undefined;
typeof a; // undefiend

a= true;
typeof a; // boolean

a= null;
typeof a; // object ( this is bug in JS, Google it to learn more about it)

a= {name:'Ashutosh'}
typeof a; // object
Profile

Ashutosh Anand Tiwari

Follow

A front-end engineer with a passion for learning and exploring the world.

🌱 Planted and watering by :

🙏 धन्यवाद ! 🙏

tiranga