What is the fastest or most elegant way to compute a set difference using Javascript arrays? - Stack Overflow

PHOTO EMBED

Mon Sep 13 2021 13:18:59 GMT+0000 (Coordinated Universal Time)

Saved by @arielvol

A = [1, 2, 3, 4];
B = [1, 3, 4, 7];

diff = A.filter(x => !B.includes(x) );

console.log(diff);
content_copyCOPY

https://stackoverflow.com/questions/1723168/what-is-the-fastest-or-most-elegant-way-to-compute-a-set-difference-using-javasc