You are viewing a single comment's thread. Return to all comments →
I found solving in Javascript
let sum = 0; for (let i = 0; i < ar.length; i++) { sum = sum + ar[i]; } return sum;
You can also use reduce() for the simple way const sum = ar.reduce((a,b) => a+b, 0); return sum;
Seems like cookies are disabled on this browser, please enable them to open this website
A Very Big Sum
You are viewing a single comment's thread. Return to all comments →
I found solving in Javascript
let sum = 0; for (let i = 0; i < ar.length; i++) { sum = sum + ar[i]; } return sum;
You can also use reduce() for the simple way const sum = ar.reduce((a,b) => a+b, 0); return sum;