JavaScript icon indicating copy to clipboard operation
JavaScript copied to clipboard

--sum-of-array

Open Yerenzter opened this issue 3 years ago • 0 comments

I propose a built-in JavaScript function which is sum() that sum all the lengths of an array.

let sum = (y) => {
        let sum = 0;

        for(r=0; r<y.length; r++) {
                sum += y[r];
        }

        return sum;
};

Yerenzter avatar Dec 19 '22 12:12 Yerenzter