November 2018
Beginner
502 pages
10h 22m
English
In JavaScript, a rest parameter collects multiple arguments and condenses them into a single argument. It is called rest because it collects the rest of the arguments into a single argument.
This syntax was introduced in ES6 and allows us to nicely implement functions that have an indefinite number of parameters.
We define a rest parameter with three dots preceding the parameter name.
Let's go through a quick example:
function logScores(...scores) { console.log(scores);}
Read now
Unlock full access