Sobes.tech
Middle

What does typeof null return?

sobes.tech AI

Answer from AI

In JavaScript, the expression typeof null returns the string 'object'. This is a historically established bug in the language, which is preserved for backward compatibility.

That is:

console.log(typeof null); // 'object'

Although null signifies the absence of a value and is not an object, the typeof operator mistakenly perceives it as an object.