2

From the mozilla documentation

var o = new Object();
o.[[Prototype]] = Foo.prototype;
Foo.call(o);

What is [[Prototype]] exactly? I tried to find a specification for that in the documentation itself, but it's just thrown at you like that.

Stefano Borini
  • 138,652
  • 96
  • 297
  • 431
  • It's basically `__proto__` now. – Redu Sep 03 '16 at 21:22
  • To find out more I'd try reading [here](http://www.w3schools.com/js/js_object_prototypes.asp) and [here](http://javascriptissexy.com/javascript-prototype-in-plain-detailed-language/) – Agent Zebra Sep 03 '16 at 21:24
  • Following the ECMAScript standard, the notation someObject.[[Prototype]] is used to designate the prototype of someObject. This is equivalent to the JavaScript property __proto__ (now deprecated). It should not be confused with the func.prototype property of functions, which instead specifies the [[Prototype]] of all instances of the given function. Since ECMAScript 6, the [[Prototype]] is accessed using the accessors Object.getPrototypeOf() and Object.setPrototypeOf(). **Referred from:** https://developer.mozilla.org/en/docs/Web/JavaScript/Inheritance_and_the_prototype_chain – Nikhilesh Shivarathri Sep 03 '16 at 21:28
  • They explain it in the docs you linked. They're using it as a notation to refer to the object(s) from which an object inherits. –  Sep 03 '16 at 21:28
  • @NikhileshShivarathri ah ok, so it's just notation, not actual code. – Stefano Borini Sep 03 '16 at 21:30
  • @squint: ok so it has no language value, it's just for documentation. – Stefano Borini Sep 03 '16 at 21:31
  • Yep, exactly. It's notation used in the spec, or at least it used to be. Not sure about the most recent versions. –  Sep 03 '16 at 21:34

0 Answers0