"," in arrow function?

I’m learning reduce method in FFC JS course. Can somebody explain the code “,0” in the code below? Thank you.

const users = [
  { name: 'John', age: 34 },
  { name: 'Amy', age: 20 },
  { name: 'camperCat', age: 10 }

const sumOfAges = users.reduce((sum, user) => sum + user.age, 0);

it’s not part of the arrow function
reduce has two arguments
the first one is

and the second one is

the second (optional) argument of reduce is the starting value of the accumulator

thank you so much <3

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