Celebrating 80th Independence Day of India• Jai Hind •Bharat Mata Ki Jai• Jai Hind •Long Live India• Jai Hind •Jai Hind• Jai Hind •

Data Types in JavaScript

Ashutosh Anand Tiwari
By Ashutosh Anand TiwariPublished Sep 4, 2024 · 2 min read
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

Continue Exploring

Profile

Ashutosh Anand Tiwari

Follow

Writer & curator of this digital garden — open notes for learners worldwide.

🌱 Planted and watering by :

🙏 धन्यवाद ! 🙏

tiranga
Request a Topic

Want me to write notes on a course?

Tell me the course, book, or research topic you want covered. If it helps learners, I'll consider adding structured digital notes for it in the garden.

Collaborate

Have a notes collection to feature here?

Do you have open notes you want featured in this digital garden? Let me know — we can collaborate and publish them for learners worldwide.