function myCall(context){
if(typeof this !== "function"){
throw new TypeError('error')
}
context = context || window
context.fn = this
let args = [...arguments].slice(1)
let result = context.fn(...args)
delete context.fn
return result
}
function myBind(context){
if(typeof this !== 'function'){
throw new TypeError('error')
}
context = context || window
context.fn = this
let result = null
if(arguments[1]){
result = context.fn(...arguments[1])
}else{
result = context.fn()
}
delete context.fn
return result
}
console