Saturday, 15 August 2015

javascript - What's the clearest way to indicate a function uses the 'arguments' object? -



javascript - What's the clearest way to indicate a function uses the 'arguments' object? -

what's best way indicate function uses 'arguments' object? sentiment based there conventions? when improve utilize array of arguments?

some examples:

// function takes n arguments , makes them pretty. function manyargs() { (var = 0; < arguments.length; i++) console.log(arguments[i]); } function manyargs( /* n1 , n2, ... */ ) function manyargs(n1 /*, n2, ... */ ) function manyargs(argarray)

// using es6 syntax ... var foo = function(/*...args*/){ // shim array.from, var args = array.from(arguments); // or var args = [].slice.call(arguments); };

javascript conventions

No comments:

Post a Comment