Next: Spread Syntax, Up: Default---Rest---Spread [Index]
Rest parameters have been introduced to reduce the boilerplate code that was induced by the ‘arguments’.
The rest parameter syntax allows one to represent an indefinite number of arguments as an array. A function’s last parameter can be prefixed with ‘...’ which will cause all remaining (user supplied) arguments to be placed within a "standard" JavaScript array.
There are three main differences between rest parameters and the ‘arguments’ object:
sort
, map
, forEach
or pop
can be applied on it directly;