Skip to content

Instantly share code, notes, and snippets.

@jubstuff
Last active January 4, 2016 11:49
Show Gist options
  • Save jubstuff/8617396 to your computer and use it in GitHub Desktop.
Save jubstuff/8617396 to your computer and use it in GitHub Desktop.
How to get all the arguments of a function but the first
function test() {
var otherArgs = Array.prototype.slice.call(arguments, 1);
console.log(otherArgs);
}
console.log('test()');
test();
console.log('test(1)');
test(1);
console.log('test(1, 2)');
test(1, 2);
console.log('test(1, 2, 3)');
test(1, 2, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment