Ad
Code
Diff
  • function addArr(arr){  
      return arr.reduce((sum, num) => sum + num, 0) || null
    }
    • function addArr(arr){
    • if(arr.length === 0) return null
    • let final = 0
    • arr.forEach(num => {
    • final += num
    • })
    • return final
    • function addArr(arr){
    • return arr.reduce((sum, num) => sum + num, 0) || null
    • }