Quantcast
Channel: javascript null returns object when used with typeof operator - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Answer by Amit Joki for javascript null returns object when used with typeof operator

$
0
0

It is . In Javascript null is an object

Kiro Risk says

The reasoning behind this is that null, in contrast with undefined, was (and still is) often used where objects appear. In other words, null is often used to signify an empty reference to an object. When Brendan Eich created JavaScript, he followed the same paradigm, and it made sense (arguably) to return "object". In fact, the ECMAScript specification defines null as the primitive value that represents the intentional absence of any object value (ECMA-262, 11.4.11).


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>