|
|
|
|
|
by ep103
4635 days ago
|
|
you made the same mistake I did at first. Corrected below. function arraySum(i) {
var total = 0
for(var x=0; x < i.length; x++) {
if(typeof i[x] == 'object') {
total += arraySum(i[x])
} else if(typeof i[x] == 'number') {
total += i[x]
}
}
return total
} |
|