|
|
|
|
|
by dmak
4639 days ago
|
|
I got 11 minutes and 14 seconds. Is that slow? The answer to my last solution was like this: function arraySum(i) {
var total = 0
for(var x=0; x < i.length; x++) {
if(typeof i[x] == 'object') {
arraySum(i[x])
} else if(typeof i[x] == 'number') {
total += i[x]
}
}
return total
}
|
|
That was also my final answer. However, I was going for speed and not elegance, after looking at other people's responses with prototypes and all.