Skip to main content

Why is typeof null "object"? | Netscape Source Code Dive

In this video CJ dives into the original Netscape C source code from 1998 (the original implementation of JavaScript) to look at why typeof null === "object" in JavaScript. He also explores the history of ECMAScript harmony and talks about why this will probably never be fixed.

View the code CJ was running here: https://gist.github.com/w3cj/754709a0643256c6179ca70656301377 View the original source code here: https://github.com/jrmuizel/mozilla-cvs-history/blob/781c48087175615674b38b31fcc0aae17f0651b6/js/src/jsapi.h

MDN typeof | https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof The history of “typeof null” | https://2ality.com/2013/10/typeof-null.html jsapi.c on the web archive | https://web.archive.org/web/20200211221355/https://dxr.mozilla.org/classic/source/js/src/jsapi.c Netscape Announces Plans to Make Next-Generation Communicator Source Code Available Free on the Net | https://web.archive.org/web/19980503010048/https://techmall.com/techdocs/TS980122-6.html jsapi.h | https://github.com/jrmuizel/mozilla-cvs-history/blob/781c48087175615674b38b31fcc0aae17f0651b6/js/src/jsapi.h c data types wikipedia | https://en.wikipedia.org/wiki/C_data_types ECMAScript Version History | https://en.wikipedia.org/wiki/ECMAScript_version_history ECMAScript Harmony Announcement | https://web.archive.org/web/20100718150639/https://mail.mozilla.org/pipermail/es-discuss/2008-August/003400.html Harmony typeof null proposal | https://web.archive.org/web/20160331031419/http://wiki.ecmascript.org:80/doku.php?id=harmony:typeof_null One JavaScript: avoiding versioning in ECMAScript 6 | https://2ality.com/2014/12/one-javascript.html