hi
I was playing around with a code. Curiously a value is returned when two zero’s were added.
const sum = (...args) => {
return args.map((a, b) => a + b, 0);
}
console.log(sum(0,0,0));
Returns me this [0,1,2]
Is it because the values are in string format?
When i pass values to sum(0,1,2) it returns me [0,2,4]
How is it that when i pass multiple zero’s it returns me values instead of zero’s