Javascript Array intersection(arr)
Array.prototype.intersection = function(arr){ return this.filter(function(n){ return arr.indexOf(n) != -1; });/*from w ww . j a v a 2 s . co m*/ }