Lets take a look at this code:
var mainFunction = function() { altFunction.apply(null, arguments); }
The arguments that are passed to \"mainF
arguments is not a pure array. You need to make a normal array out of it:
arguments
var mainArguments = Array.prototype.slice.call(arguments); mainArguments.push("extra data");