С
Size: a a a
С
ᅠ
M
С
С
ᅠ
Function.prototype.myBind = function(context, ...rest1) {
if (context === null || context === undefined) {
return (...rest2) => this(...rest1, ...rest2);
}
let fnContext;
switch (typeof context) {
case 'number':
fnContext = new Number(context);
case 'string':
fnContext = new String(context);
case 'boolean':
fnContext = new Boolean(context);
default:
fnContext = context
}
return (...rest2) => {
const name = window.myBindID ? window.myBindID : 1;
window.myBindID = name + 1;
fnContext[name] = this;
const result = fnContext[name](...rest1, ...rest2);
delete fnContext[name];
return result;
};
};
ᅠ
ᅠ
EV
Function.prototype.myBind = function(context, ...rest1) {
if (context === null || context === undefined) {
return (...rest2) => this(...rest1, ...rest2);
}
let fnContext;
switch (typeof context) {
case 'number':
fnContext = new Number(context);
case 'string':
fnContext = new String(context);
case 'boolean':
fnContext = new Boolean(context);
default:
fnContext = context
}
return (...rest2) => {
const name = window.myBindID ? window.myBindID : 1;
window.myBindID = name + 1;
fnContext[name] = this;
const result = fnContext[name](...rest1, ...rest2);
delete fnContext[name];
return result;
};
};
A
Function.prototype.myBind = function(context, ...rest1) {
if (context === null || context === undefined) {
return (...rest2) => this(...rest1, ...rest2);
}
let fnContext;
switch (typeof context) {
case 'number':
fnContext = new Number(context);
case 'string':
fnContext = new String(context);
case 'boolean':
fnContext = new Boolean(context);
default:
fnContext = context
}
return (...rest2) => {
const name = window.myBindID ? window.myBindID : 1;
window.myBindID = name + 1;
fnContext[name] = this;
const result = fnContext[name](...rest1, ...rest2);
delete fnContext[name];
return result;
};
};
EG
Ж
Ж
SS
SS