How do I keep the this context of my original function after calling .apply()?
问题 I have a functionA which accepts a function as a parameter. I want to manipulate the arguments of that function in functionA and return this as functionC. I found that I can do this with .apply(), however the original context of functionB is lost and instead replaced by functionA. For example, var factory = { return { fnB: function() {} } }; fnA(fn) { return fnC(params) { var customparams = [params, {something: else}] return method.apply(null, customparams); } } var load = fnA(factory.fnB);