javascript get duplicates of multiple arrays 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 create array with repeated values
Array(5).fill(2)
//=> [2, 2, 2, 2, 2]