Question regarding duplicate __proto__ properties

Jeff Walden jwalden+es at mit.edu
Wed Dec 3 17:16:19 PST 2014


On 11/30/2014 10:35 AM, Michał Wadas wrote:
> Should it be possible to have property named "__proto__" which is inaccessible in modern implementations?

It's perfectly accessible.

  var obj = { ["__proto__"]: 42, __proto__: null };
  assert(obj.__proto__ === 42);
  assert("__proto__" in obj);
  assert(Reflect.get(obj, "__proto__") === 42); // ...if I remember R.get's name/semantics
  assert(Object.getOwnPropertyDescriptor(obj, "__proto__").value === 42);
  assert(Object.getPrototypeOf(obj) === null);

And so on.

On the original topic, SpiderMonkey's implemented this since Firefox 35, which I think means the current Firefox beta implements the __proto__ non-duplication requirements.

Jeff


More information about the es-discuss mailing list