// JavaScript Recursive Function:
// A recursive function is a function that calls itself until it doesn't.
function sumArray(array) {
let sum = 0;
for (const item of array) {
sum += Array.isArray(item) ? sumArray(item) : item;
}
return sum;
}
sumArray([1, [4, 6]]); // => 11