JS Built-ins
Operatorsintermediate

Operators β€” ...rest parameters

Rest collects remaining arguments

When ... appears in a function parameter, it collects all remaining arguments into an array.

Challenge: Write sumAll(first, ...rest) that returns the sum of first plus all elements of rest.

πŸ’‘ Hints (1)
  • β€’ rest is an array β€” use .reduce() or a for loop