bind polyfill code example
Example: polyfill for bind
Function.prototype.myBind = function (...args) {
const that = this
const params = args.slice(1)
return function (...args2) {
that.apply(args[0], [...params, ...args2])
}
}
Function.prototype.myBind = function (...args) {
const that = this
const params = args.slice(1)
return function (...args2) {
that.apply(args[0], [...params, ...args2])
}
}