Sum of all the components of an array

Sum of all the components of an array

andreavelloneandreavellone Posts: 46Questions: 13Answers: 2

so i had to render a data.
Data sound like this data[0], data[1], data[2], data[n]
I must sum all the components

I tried something like this

for(var i = 0; i < data.length; i += 1) {
    
            data + data[i];
                            } 
            return data; }

but, of course, don't run

any solution?

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.