function myCall(context){
let obj = context || window
obj.fn = this
let args = [].slice.call(arguments,1)
let res = obj.fn(...args)
delete obj.fn
return res
}
Function.prototype.myApply = function(context,arr){
let obj = context || window
obj.fn = this
let args = [].slice.call(arr)
let res = obj.fn(...args)
delete obj.fn
return res
}
Function.prototype.myBind = function(context){
let obj = context || window
let args = [].slice.call(arguments,1)
let fn = this
let bound = function(){
let params = [].slice.call(arguments)
fn.apply(this.constructor === fn?this:obj,args.concat(params))
}
bound.prototype = Object.create(fn.prototype)
return bound
}
Object.prototype.myCreate(proto){
function fn(){}
fn.prototype = proto
return new fn()
}
console