__proto__
property has been deprecated as of ECMAScript 3.1 and shouldn't be used in the code. Use getPrototypeOf
method instead.
When an object is created __proto__
is set to the original prototype property of the object’s constructor function. getPrototypeOf
is the preferred method of getting "the prototype".
Examples of incorrect code for this rule:
/*eslint no-proto: "error"*/
var a = obj.__proto__;
var a = obj["__proto__"];
Examples of correct code for this rule:
/*eslint no-proto: "error"*/
var a = Object.getPrototypeOf(obj);
If you need to support legacy browsers, you might want to turn this rule off, since support for getPrototypeOf
is not yet universal.