i don’t know how to add them up if they’re together

They’re just numbers in an array, just eg

```
const input = [1, 1, 1, 1]
let sum = 0;
for (let i = 0; i < input.length; i++) {
sum += input[i];
}
return sum;
```

what if its 1,1,1 ,4 , 2,2,2 ? obviously i don’t wanna add all of them up. add 1s together and 2s in their own space so i want `3,4,6`

If the previous value in the array is the same as the current one in the array, add to a sum variable. If it isn’t, push the current sum to your output array and set the sum to the current value.

You shouldn’t care what the next value is, or how many consecutive values there are or anything, you just need to keep track of the current/previous values in the array are (the loop does this already), and the current sum