Open this example in the interactive library
Source code
const a = [1, 2, 3],
b = new Set([2, 4]);
console.log(a.filter((x) => !b.has(x)));
Sample output
[ 1, 3 ]

Open this example in the interactive library
const a = [1, 2, 3],
b = new Set([2, 4]);
console.log(a.filter((x) => !b.has(x)));
[ 1, 3 ]