Tell us what’s happening:
Describe your issue in detail here.
Why have we placed a 0 after a+b in the reduce() function?

  **Your code so far**

const sum = (...args) => {
return args.reduce((a, b) => a + b, 0);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36

Challenge: Use the Rest Parameter with Function Parameters

Link to the challenge:

it’s the starting value of the accumulator, really useful if the array elements are of a different type than the intended output

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.