Data Types in JavaScript

Interviewer : Tell me all data types in JavaScript?
You: There are total 8 built in data types in JavaScript.
- string
- number
- boolean
- null
- undefined
- object
- symbol ( ES6 feature)
- 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