Function.prototype.myCall = function (obj = window, ...arg) {
const key = Symbol();
let result;
obj[key] = this;
result = obj[key](...arg);
delete obj[key];
return result;
};
Function.prototype.myApply = function (obj = window, arr) {
const key = Symbol();
let res;
obj[key] = this;
res = obj[key](...arr);
delete obj[key];
return res;
}
Function.prototype.bind = function (obj = window, ...arg) {
const that = this;
return function () {
that.call(obj, ...arg);
}
}