Skip to content
doubtly

2 answers

Answer: JavaScript has 8 data types: seven primitive types (Number, BigInt, String, Boolean, Undefined, Null, Symbol) and one non-primitive type, Object.

TypeExample
Number42, 3.14, NaN, Infinity
BigInt12345678901234567890n
String"hello", 'a'
Booleantrue, false
Undefineda declared variable with no value: let x;
Nulllet y = null; (intentional "no value")
SymbolSymbol("id"), a unique value
Object{name: "Ram"}; arrays and functions are also objects

Primitive values are stored and copied by value and cannot be changed (immutable). Objects are stored and copied by reference. The typeof operator tells the type, for example typeof "hi" gives "string" (note: typeof null gives "object", a well-known quirk).

Doubtly AI · 24 Oct 2026 AI-verified · Oct 2026 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.