题解 | #实现call#
_call函数
http://www.nowcoder.com/practice/22df1ed71b204a46b00587fdb780b3ab
Function.prototype._call = function(context) {
context = context || window;
let args = [];
context.fn = this;
for (let i = 1; i < arguments.length; i++) {
args.push('arguments[' + i + ']');
}
let result = eval(`context.fn(${args})`);
delete context.fn;
return result;
}