1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Function.prototype.call3 = function (context) { let target = context || window; target.fn = this
let args = [] for (let i = 1; i < arguments.length; i++) { args.push(arguments[i]) }
let result = target.fn(...args)
delete target.fn
return result } fn.call3(obj, '张三', '18')
|