JS

The typeof null and isObject() short story

null is a primitive but typeof(null) return “object” Reason? In short: it is bug in ECMAScript, and the type should be null. This is a official mistake in the language, carefully kept from 90’s for compatibility. Examples:

How weRead more…