function bar(name, age) { console.log(name) console.log(age) console.log(this.value); } var foo = { value: 1 }; // foo.bar() Function.prototype.call2=function(context,...args){ const func=this; context.func=func; context.func(...args); delete context.func } bar.call2(foo, 'kevin', 18);