Hey wats up, im trying to split a list,using the first half process with += -=, and the second half process with the first half += -=? eg 0,1,2,10,10,10 the final list would be 22,10,-2.
i can generate the values but how would i add them? could i declare them as variables or something? im only 2 wks in so any advice is appreciated.
[code] a = [0,1,2,1,10,10,10,10,10]
a.forEach(function(item, i) {
if (item == 0) a[i] += 12;
if (item == 1) a[i] += 0;
if (item == 2) a[i] -= -12;
});
Thanks
Remark by Sempervivum: Unfortunately the forum software had eaten your “[i]“[code]your code here[/code]
I edited this posting accordingly.