DEV Community

Jalaj Bankar
Jalaj Bankar

Posted on

Observation #3

Did you know that,

console.log(typeof(null))
->object

obviously you did right ? but,

did you know why ?

well there's not really a strong reason behind it, but the reason is :

'In JavaScript, the typeof null operator mistakenly returns "object", even though null is a primitive value representing the intentional absence of any object value. This behavior is considered a bug that originated in the early versions of JavaScript and has persisted due to concerns about breaking existing code.'

Top comments (0)