Ad
Code
Diff
  • const addArr = (arr) => {
      let sum = arr.reduce((acc, num) => acc + num, 0);
      
      return sum || null
    }; 
    
    • const addArr = (arr) => {
    • let sum = 0;
    • for (let i = 0; i < arr.length; i++) {
    • sum += arr[i];
    • }
    • return sum || null;
    • };
    • let sum = arr.reduce((acc, num) => acc + num, 0);
    • return sum || null
    • };