题解 | #_call函数#
_call函数
http://www.nowcoder.com/practice/22df1ed71b204a46b00587fdb780b3ab
Function.prototype._call = function(context,..args){
// 处理容错
context = (typeof context === 'object' ? context : window)
args = args ? args : []
//给context新增一个独一无二的属性以免覆盖原有属性
const key = Symbol();
context[key] = this;
//通过隐式绑定的方式调用函数
const result = context[key](...args);
//删除添加的属性
delete context[key]
//返回函数调用的返回值
return result
}
