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

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -