5 hands-on exercises and 5 find-the-bug challenges for the JavaScript Rest Parameters lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Use a rest parameter to add 1, 2, 3 and 4.
Count how many scores were passed after the title.
Show the length when no extra arguments are given.
Find the largest of 5, 12, 8 and 44 using a rest parameter.
Spread an array of three items into a function that collects them, then show the count.
Without the three dots only the first argument is received.
A rest parameter must be last, so the title is being swallowed.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceReading length on a plain parameter that was never passed fails.
Math.max needs separate numbers, not one array.
Without spreading, the function receives a single array.