Why is typeof null, {}, [] equal to “object”?

Nikhil Nambiar
1 min readFeb 2, 2020

--

Short answer it’s a bug.

Here is something you can try in your browser console:

typeof 123 
//"number"
typeof "what's my type"
//"string"
typeof `what is my type ${1+2}`
//"string"
typeof null
//"object"
typeof []
//"object"
typeof {}
//"object"

--

--