Function.prototype.myBind = function (obj, ...param) {
const uniqueName = Symbol();
obj[uniqueName] = this;
return (...subParam) => {
obj[uniqueName](...[...param,...subParam]);
delete obj[uniqueName];
};
};
Function.prototype.myBind = function (obj, ...param) {
const uniqueName = Symbol();
obj[uniqueName] = this;
return (...subParam) => {
obj[uniqueName](...[...param,...subParam]);
delete obj[uniqueName];
};
};
本文标题:实现bind,不用apply 和call
本文链接:https://www.haomeiwen.com/subject/trklortx.html
网友评论