Rest
Array Rest
Rest parameters are the equivalent for variadic parameters in some other languages.
The add
function below can take any number of parameters which will end up in the valueList
Array
.
It is better to avoid the usage of "rest" parameters.
It reduces the extensibility of the function. It is better to use one parameter of type Array
that contains all the values.
Object Rest
The same syntax can be used with the destructuring of an object.
Last updated