Javascript Array intersect(array)
Array.prototype.intersect = function (array) { array = Array.isArray(array) ? array : []; return this.filter(function (n) { return array.indexOf(n) != -1; });/* w w w .j av a 2s . com*/ };
Array.prototype.intersect = function(array){ return(this.filter(function(n){ return array.include(n); })); };
Array.prototype.intersect = function(array) { return this.filter((x) => array.indexOf(x) != -1); };