How this work from js es6 topic 9?

const product = (...n) => {
  return n.reduce((a, b) => a * b, 1);
}

how this multiply actually work?

product(1,2)
product(1,2,3,4)

this all give answer but how?

Take a look at the reduce method and the spread syntax on MDN.

What specifically do you not understand?

thank you for giving this information I really don’t know about this.

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