Ad
Fundamentals
Arrays
Data Types
Code
Diff
  • const getSum = array => array.reduce((acc, i) => acc + i)
    • var sum=0;
    • const getSum = (array) => {sum=0; array.every( Sum = (curvalue) => {sum+=curvalue; return true; }); return sum;}
    • const getSum = array => array.reduce((acc, i) => acc + i)