Skip to content
Advertisement

Tag: prototype-chain

Why is mutating the [[prototype]] of an object bad for performance?

From the MDN docs for the standard setPrototypeOf function as well as the non-standard __proto__ property: Mutating the [[Prototype]] of an object, no matter how this is accomplished, is strongly discouraged, because it is very slow and unavoidably slows down subsequent execution in modern JavaScript implementations. Using Function.prototype to add properties is the way to add member functions to javascript

Advertisement