function bind(context, fn) {
return function (...args) {
fn.apply(context, args);
}
}
function logPerson() {
console.log(`Person:${this.name}, ${this.age}, ${this.job}`);
}
const person1 = {
name: "Danil",
age: 22,
job: "Front-end",
}
const person2 = {
name: "Danil__2",
age: 19,
job: "Front-end",
}
bind(person1, logPerson)();