Why are the rest parameters in JavaScript called so? -


why rest parameters in javascript called so?

they called rest parameters because capture the rest of parameters when function invoked.

function multiply(multiplier, ...theargs) {   return theargs.map(function (element) {     return multiplier * element;   }); } 

example https://developer.mozilla.org/en-us/docs/javascript/reference/rest_parameters#browser_compatibility

...theargs captures parameters 2+. in other words, multiplier first parameter , theargs rest.


Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -