Last active
January 4, 2016 11:49
-
-
Save jubstuff/8617396 to your computer and use it in GitHub Desktop.
How to get all the arguments of a function but the first
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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