compare two arrays and make sure there are no duplicates js

JavaScript
array1 = array1.filter(val => !array2.includes(val));

Source

Also in JavaScript: