0 of 8 problems solved • 0%

Exercise prompt

Use Rest Parameters

A rest parameter gathers remaining arguments into an array.

Example

function listNames(...names) { console.log(names); } listNames("Mira", "Leo"); // Output: // ["Mira", "Leo"]
  • ...names collects "Mira" and "Leo" into ["Mira", "Leo"].
  • A rest parameter must be last. Any earlier parameters receive their arguments first.

Your task

Repair the parameter of totalScores so its loop receives all four score arguments instead of only the final three. Keep the function call and console statement, and make the output Total: 18.