Javascript Array intersect(other)
Array.prototype.intersect = function(other) { let ret = [];/* w w w . ja v a 2 s . c o m*/ for (let val of this) { if (other.contains(val)) { ret.push(val); } } return ret; };