Ad
Code
Diff
  • function addArr(arr){
      return arr.length?arr.reduce((a,e)=>a + e,0):null;
    }
    • function addArr(arr){
    • if(arr.length === 0) return null
    • let final = 0
    • arr.forEach(num => {
    • final += num
    • })
    • return final
    • return arr.length?arr.reduce((a,e)=>a + e,0):null;
    • }