M
Michael Haufe (\TNO\)
I'm trying to combine certain values in an array without resorting to
loops, but I can't get it to come out right (My diet is lacking in
Omega-3 or something today), So I'm hoping someone has a fresh
perspective on my problem:
var arr = [1, 2, 3, "a", "b", "c", 4, 5, 6];
var result = arr.reduce(function(a,b){
//how would you approach this?
});
// result should equal [6, "a", "b", "c", 15]
loops, but I can't get it to come out right (My diet is lacking in
Omega-3 or something today), So I'm hoping someone has a fresh
perspective on my problem:
var arr = [1, 2, 3, "a", "b", "c", 4, 5, 6];
var result = arr.reduce(function(a,b){
//how would you approach this?
});
// result should equal [6, "a", "b", "c", 15]