Wrapping and Arguments

Rest Operator works, whereas arguments variable does not.

by MegaScience

JavaScript

function test(x, y) {
	alert((void 0 === x) + " " + y);
}

(function() {
	function wrap(b) {
		return function (...args) {
			//arguments[1] = pageSize;
			args[1] = "test";
			return b.apply(this, args);
		};
	}

	if(test) {
		test = wrap(test);
	}
})();

test();