Object.seal, read references, and code reliability

T.J. Crowder tj.crowder at farsightsoftware.com
Tue Aug 15 13:49:56 UTC 2017

On Tue, Aug 15, 2017 at 2:43 PM, Alex Kodat <akodat at rocketsoftware.com>
> Sure but these all exist on Object.prototype so these would never
> throw for guarded objects. Maybe I'm missing something here?

Not all objects inherit from `Object.prototype`. Example:

const o = Object.create(null);
console.log("valueOf" in o);           // false

In fact, not even all objects with prototypes inherit from

const b = Object.create(null);
console.log("valueOf" in b);           // false
console.log(Object.getPrototypeOf(b)); // null
const d = Object.create(b);
console.log("valueOf" in d);           // false
console.log(Object.getPrototypeOf(d)); // b

-- T.J. Crowder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170815/07a5495d/attachment.html>

More information about the es-discuss mailing list