In JavaScript, null is a primitive value, but typeof reports it as what?
2025
In JavaScript, null is a primitive value, but typeof reports it as what?
- A.
null
- B.
object
- C.
number
- D.
string
- E.
undefined
Attempted by 77 students.
Show answer & explanation
Correct answer: B
Correct answer: object.
In JavaScript, typeof null returns "object". This is a long-standing historical behavior of the language, even though null itself is a primitive value.
Loading lesson…