Function.prototype.cbind = function (...outer_args) {
let that = this,
params = outer_args.slice(1),
obj = outer_args[0];
return function (...inner_args) {
that.apply(obj, [...params, ...inner_args]);
}
}
Function.prototype.myBind = function (...args) {
const that = this
const params = args.slice(1)
return function (...args2) {
that.apply(args[0], [...params, ...args2])
}
}