I\'m looking for a good algorithm to get all the elements in one array that are not elements in another array. So given these arrays:
var x = [\"a\",\"b\",\
in ES6 simply
const x = ["a", "b", "c", "t"]; const y = ["d", "a", "t", "e", "g"]; console.log( y.filter(e => !x.includes(e)) );
(another option is y.filter(e => x.indexOf(e)===-1) )
y.filter(e => x.indexOf(e)===-1)