Why is this an issue?
prototype. That prototype object has a prototype of its own, and the whole sequence is called a prototype chain. When
accessing a property or a method of an object, if it is not found at the top level, the search continues through the object’s prototype and then
further down the prototype chain. This feature allows for very powerful dynamic inheritance patterns but can also lead to confusion when compared to
the classic inheritance.
To simplify the access to the prototype of an object some browsers introduced the
__proto__ property, which was later deprecated and
removed from the language. The current ECMAScript standard includes
methods that should be used instead of the
let prototype = foo.__proto__; // Noncompliant: use Object.getPrototype
foo.__proto__ = bar; // Noncompliant: use Object.setPrototype
To fix your code replace
__proto__ with calls to
let prototype = Object.getPrototype(foo);