I know that every JavaScript object has an internal property called [[Prototype]]
. Some implementations allow access to it via a property called __proto__
while other do not. Is there any special significance of the brackets surrounding this property?
It is an "internal property" of the object. From ECMAScript 8.6.2:
This specification uses various internal properties to define the semantics of object values. These internal properties are not part of the ECMAScript language. They are defined by this specification purely for expository purposes. An implementation of ECMAScript must behave as if it produced and operated upon internal properties in the manner described here. The names of internal properties are enclosed in double square brackets [[ ]].
The statement, "These internal properties are not part of the ECMAScript language," means that internal properties are not identifiers that can be used in actual code -- internal properties are not accessible as members of the objects that contain them. However, they may be made accessible by particular functions or properties (e.g., some browsers are kind enough let you set and get [[Prototype]]
through the __proto__
property, and the ES5 spec allows read-only access through Object.getPrototypeOf
).
The use of double brackets over single brackets is probably to avoid any possible confusion with actual bracket notation (i.e., property access).