← Practice
Modern JavaScript·easy 10 min 50 XP

Spread / Rest Challenge

Write sum(...numbers) using rest parameters to add any number of arguments.

Examples

  • sum(1, 2, 3) → 6
  • sum() → 0

Constraints

  • Keep the required function name so the tests can find it
  • Return a value instead of only logging it
  • Do not mutate inputs unless the challenge asks you to
Spread / Rest Challenge · editor

Code runs in an isolated Web Worker with a 3-second timeout — no DOM access, and it can never hang the page.