Function.prototype.call = function(context, ...rest) { const ctx = context || window; ctx.fn = this; const result = eval("ctx.fn(...rest)"); delete ctx.fn; return result; }; const me = { name: 'Jack' } function say() { console.log(`My name is ${this.name || 'default'}`); } say.call(me)