function arguments

by peterbenoit

JavaScript

function test() {
    var slice = Array.prototype.slice,
        allArgs = slice.call(arguments, 0),
        allButFirst = slice.call(allArgs, 1);
    
    console.log(allButFirst);
}

test("hi","there");
test(1,2,3,4,5);
test((function(){alert('hi')}),(function(){alert('hi')}));