Convert Arguments Into An Array
Super easy, one line method!
JavaScript
function do_something() {
var args = [].slice.call(arguments, 0);
console.log(args);
};
do_something(1, 2, 3);Output
[1, 2, 3]
Super easy, one line method!
function do_something() {
var args = [].slice.call(arguments, 0);
console.log(args);
};
do_something(1, 2, 3);[1, 2, 3]
An easy, one line way to convert a function's Arguments into an array.