Because you're only passing one argument — the array.
Try alert(foo(1,2,3,4,5));
Arguments are numbered from 0 in JavaScript, so when you start your slice at 1 and pass 1 argument, you get nothing.
Note that it can hamper optimization to allow the arguments object to "leak" out of a function. Because of the aliasing between arguments and the formal parameters, an optimizer can't really do any static analysis of the function if the arguments object gets sent somewhere else, because it has no idea what might happen to the parameter variables.
Because you're only passing one argument — the array.
Try alert(foo(1,2,3,4,5));
Because you're only passing one argument — the array.
Try alert(foo(1,2,3,4,5));
Arguments are numbered from 0 in JavaScript, so when you start your slice at 1 and pass 1 argument, you get nothing.
Note that it can hamper optimization to allow the arguments object to "leak" out of a function. Because of the aliasing between arguments and the formal parameters, an optimizer can't really do any static analysis of the function if the arguments object gets sent somewhere else, because it has no idea what might happen to the parameter variables.