AI

The Rest operator (...) collects multiple elements into a single array. It's great for functions that accept any number of arguments.

Your Task:

  • Create a function sumAll that accepts any number of arguments using the rest operator ...numbers
  • Inside, use numbers.reduce() to sum them all up
  • Return the total sum
  • Call sumAll(1, 2, 3, 4) and store it in total
TypeScript Solution
Loading...

Submit your code to see test results