Question: I switch panes often and when I press ctrl-a-right I move the the right. Then if I start typing "vim", the 'v' causes a ctrl-a-v (split vertically) to be issued, but I don't want this. How do I make tmux realize this?

Answer: 
Try using .filter when adding each array to the final one, filtering out the duplicates:

```
a.filter(function(item) {
    return !finalArray.contains(item));
});

```
Answer using `Sets`:

```
var a = [1,2,3,4,5];
var b = [1,2,7,8];
var c = [1,2,3,4,5,6,7,8];
var d = [9,10,11,12];

var concat = a.concat(b).concat(c).concat(d);
var union = new Set(concat);
//console.log(union);

```

ES6 Answer:

```
let a = new Set([1,2,3,4,5]);
let b = new Set([1,2,7,8]);
let c = new Set([1,2,3,4,5,6,7,8]);
let d = new Set([9,10,11,12]);

let arr = new Set([...a,...b,...c,...d]);
//Result in arr.

```

Whats going on???

From <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set>:

> 
> The Set object lets you store unique values of any type, whether
>  primitive values or object references.
> 
> 
> 

So when we initialise `Sets` passing arrays to the constructor we basically ensure that there are no duplicate values.

Then in the last line, we concat all the `Sets` we initialised prior into a final set.

The `...` notation converts the `Set` into an `array`, and when we pass the 4 arrays to the constructor of the `Set` they get concatenated and a `Set` of their unique values is created.