Node.js examples for Array:Set Operation
Return the intersection of two arrays given in parameter
/**/*from w w w.j a v a 2 s .c o m*/ * Return the intersection of two arrays given in parameter * * @param arr1 * @param arr2 * @return {[]} The intersection of the two arrays. */ intersect = function(arr1, arr2) { return arr1.filter(function(n) { return arr2.indexOf(n) > -1; }); };