Yes, null
and undefined
are the only values that throw an exception when being used in a property access. The dot and bracket property accessors do invoke the internal CheckObjectCoercible function, which is defined as following:
The abstract operation
CheckObjectCoercible
throws an error if its argument is a value that cannot be converted to an Object usingToObject
. It is defined by Table 15:Table 15 — CheckObjectCoercible Results Argument Type | Result --------------+------------------ Undefined | Throw a TypeError exception. Null | Throw a TypeError exception. Boolean | Return Number | Return String | Return Object | Return
null
and undefined
being the values that represent Nothing cannot be converted to objects ("wrapped" as you say). Notice that you could of course have an object with an existing property that throws on access, like
var o = {get p() { throw new TypeError("you may not access this"); }};
o.p // TypeError