Hi I want to compare values in arrays and if they are same I want them to be considered as one.

```
var arrA = [1,1,1,1,2,2,2,3,3,4,4]

```

---

```
var arrB = [0.1,0.1,0.1,0.1 ,0.2,0.2,0.2 ,0.3,0.3 ,0.4,0.4]

```

What I want to do is to compare values of arrA if `arrA[i] == arrA[i+1]` then it should consider it as one value and in arrB the values of `arrB[i]` adds up with `arrB[i+1]`.

My final array shall look like this:

```
var arrA = [1,2,3,4]

```

---

var arrB = [0.4,0.6,0.6,0.8]

Can anyone help me with the javascript code for this. Thank you!