Wednesday, January 4, 2017

Object.getPrototypeOf() & Object.prototype.__proto__

Object.getPrototypeOf(obj)

The prototype of the given object. If there are no inherited properties, null is returned.

var proto = {};
var obj = Object.create(proto);
Object.getPrototypeOf(obj) === proto; // true

Opera-specific notes
Even though older Opera versions don't support Object.getPrototypeOf() yet, Opera supports the non-standard __proto__ property since Opera 10.50.

@reference_1_mozilla

Object.prototype.__proto__

Warning: While Object.prototype.__proto__ is supported today in most browsers, its existence and exact behavior has only been standardized in the ECMAScript 6 specification as a legacy feature to ensure compatibility for web browsers. For better support, it is recommended that only Object.getPrototypeOf() be used instead.

 @reference_2_mozilla
@reference_3_2ality

Object.prototype.constructor.prototype ?

No comments:

Post a Comment