Today's puzzle
What's missing in this code?
// getNestedArrayLength([1, [2, [3, [4, [5, 6]]]]]); // -> 6
// getNestedArrayLength([1, [[2, [3, [4, 5]]]]]); // -> 5
// getNestedArrayLength([1, [2, 3], [[4]]]); // -> 3
function getNestedArrayLength(array) {
let sum = 0;
for (let count = 0; count < array.length; count++) {
if (Array.isArray(array[count])) {
sum +=
(array[count]);
} else {
;
}
}
return
;
}
Type or select from these options