Function.prototype.myCall = function(self, ...args) {
let fn = this
self = self ? Object(self) : window
self.fn = fn
let result = self.fn(...args)
delete self.fn
return result
}
Function.prototype.myApply = function(self, args) {
let fn = this
self = (self !== null && self !== undefined) ? Object(self) : window
self.fn = fn
args = args || []
let result = self.fn(...args)
delete self.fn
return result
}
Funtion.prototype.myBind = function(self, ...args1) {
let fn = this
self = (self !== null && self !== undefined) ? Object(self) : window
return funtion(...args2) {
self.fn = fn
args = [...args1, ...args2]
let result = self.fn(...args)
delete self.fn
return result
}
}