Here you can find the source of union(a)
// These are super slow, but they're being applied to arrays of length <= 6. Array.prototype.union = function(a) { return this.concat(a.remove(this)); }
Array.union = function(a, b){ return a.concat(b).uniquelize(); };
Array.prototype.union = function (arr) { return this.concat(arr).distinct(); };
Array.prototype.union = function (ary) { return this.concat(ary).distinct(); };
Array.prototype.union = function(b) { return this.concat(b).uniquelize(); };