June 2016
Intermediate to advanced
910 pages
18h 59m
English
The rest parameter is also represented by the "…" token. The last parameter of a function prefixed with "…" is called as a rest parameter. The rest parameter is an array type, which contains the rest of the parameters of a function when number of arguments exceeds the number of named parameters.
The rest parameter is used to capture a variable number of the function arguments from within a function.
Before ES6, the programmers used the arguments object of a function to retrieve the extra arguments, passed to the function. The arguments object is not an array, but it provides some interfaces that are similar to an array.
Here is a code example that shows how to use the arguments object to retrieve the extra arguments:
function myFunction(a, ...
Read now
Unlock full access