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.