As you know, is __proto__ outdated .
MDN: Warning. The property __proto__is deprecated and should not be used.
What is a quick and cross-browser alternative for __proto__? In my case, I am changing the __proto__functions. Therefore, I can not find an alternative.
outdated code
var proto = {};
proto.bar = function (x) { return this(x) + 10; };
proto.buzz = function () { return this(4); };
proto = _.extend(proto, (function(){}).__proto__);
var foo = function (x) { return 2 * x; }
foo.__proto__ = proto;
slow alternative ( jsperf )
var foo = function (x) { return 2 * x; };
foo.bar = function (x) { return this(x) + 10; };
foo.buzz = function () { return this(4); };
Is there a quick and cross-browser alternative?
seyed source
share