Here is the code snippet to analyze:
/*jslint white:true, devel:true*/
var foo = function () {
'strict mode';
console.log(
Array.prototype.slice.call(
/* How can I send more arguments to call after 'arguments'? */
arguments,
/*
This function gets sent to slice.
If I sent a '2' it would start the array at the third index.
*/
function () {
console.log("bar");
}
)
);
};
foo(1, 2, 3, 4, 5, 6);
Exploring the workings of parameters in this scenario. It appears that the second argument is consistently passed to slice.
Is there a way to add another parameter to call here? Or should I reconsider structuring the code to use .slice()
and .call()
separately?
UPDATE:
Baffled by the negative feedback received on this post. My confusion stemmed from thinking that .slice
was dominating instead of receiving all arguments through .call()
. Grateful for Quentin's explanation.