What are JavaScript data types?
Answer
JavaScript has 8 data types. Seven are primitive (immutable, stored by value): Number (64-bit float, includes integers and floats — NaN and Infinity are also Numbers), BigInt (arbitrary precision integers — 9007199254740991n), String (immutable sequence of characters), Boolean (true/false), undefined (variable declared but not assigned), null (intentional absence of a value), and Symbol (unique, immutable value used as object property keys). The eighth is Object (mutable, stored by reference) — which includes plain objects, arrays, functions, dates, maps, sets, etc. Use typeof to check types: note that typeof null === "object" is a historical bug in JavaScript.
Previous
What is the difference between var, let, and const?
Next
What is the difference between == and === in JavaScript?