Skip to content

Instantly share code, notes, and snippets.

@jridgewell
Last active December 3, 2019 23:49
Show Gist options
  • Select an option

  • Save jridgewell/48c3d6c6ea0e0f087e980b93722fbc00 to your computer and use it in GitHub Desktop.

Select an option

Save jridgewell/48c3d6c6ea0e0f087e980b93722fbc00 to your computer and use it in GitHub Desktop.
Non-writable super-super prototype descriptor with TypedArraySet
"use strict";
const o = { __proto__: new Int32Array(10) };
Object.defineProperty(Object.prototype, 1.3, {
value: 42,
writable: false,
});
o[1.3] = 1; // Does this throw?
// If it does, then set finds the Object.prototype[1.3] PropertyDescriptor
console.log(o[1.3]); // Does this find 42 or 0?
// If it returns 0, then set did not find the Object.prototype[1.3] PropertyDescriptor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment