let obj = {
name: "71",
};
let obb = {
name: "741",
getName: function (age) {
age && (this.age = age);
console.log(this);
},
};
const objbind = obb.getName.bind(obj, 211)
objbind()
Function.prototype.mybind = function (target, ...args) {
let fn = this;
return function (...params) {
fn.apply(target, args.concat(params))
}
}
const objmybind = obb.getName.mybind(obj)
objmybind(11)