0

however, when the data is in the form of a float in an array like this

[46.18, 3000000, 0, 0, 0, 0, 0, 15.33, 0]

how do you add up the array data. I have tried but failed

let data = [46.18, 3000000, 0, 0, 0, 0, 0, 15.33, 0]

data.reduce((total, value) => value + total)

// output

3,000,061.5100000002

0 Answers0