I\'m trying to sum a nested array [1,2,[3,4],[],[5]] without using loops but I don\'t see what\'s wrong with what I have so far.
[1,2,[3,4],[],[5]]
function sumItem
try with
function sumItems(array) { let sum = 0; array.forEach((item) => { if(Array.isArray(item)) { sum += sumItems(item); } else { sum += item; } }) return sum; }