Following are the JavaScript Data types:
- Number
- String
- Boolean
- Object
- Undefined
Best answer
Following are the JavaScript Data types:
Answer: JavaScript has 8 data types: seven primitive types (Number, BigInt, String, Boolean, Undefined, Null, Symbol) and one non-primitive type, Object.
| Type | Example |
|---|---|
| Number | 42, 3.14, NaN, Infinity |
| BigInt | 12345678901234567890n |
| String | "hello", 'a' |
| Boolean | true, false |
| Undefined | a declared variable with no value: let x; |
| Null | let y = null; (intentional "no value") |
| Symbol | Symbol("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).
Log in or create a free account to answer this question.