find same item in 2 arrays javascipt code example
Example 1: javascript get same elments from multiple arrays
var result = arrays.shift().filter(function(v) {
return arrays.every(function(a) {
return a.indexOf(v) !== -1;
});
});
Example 2: javascript find matching elements in two arrays
const intersection = array1.filter(element => array2.includes(element));