javascript compare multiple arrays and keep duplicates code example
Example 1: compare two arrays and make sure there are no duplicates js
array1 = array1.filter(val => !array2.includes(val));
Example 2: javascript create array with repeated values
Array(5).fill(2)
//=> [2, 2, 2, 2, 2]