Node.js examples for Array:Set Operation
Union two array
Array.prototype.union = function (other) { var hash = {};//from w w w . j a va2 s .c o m for (var i = 0; i < this.length; i++) { hash[this[i]] = true; } for (var j = 0; j < other.length; j++) { hash[other[j]] = true; } return Object.keys(hash); };