compare 2 arrays return duplicates javascript code example
Example: compare two arrays and make sure there are no duplicates js
array1 = array1.filter(val => !array2.includes(val));
array1 = array1.filter(val => !array2.includes(val));