arr-diff
arr-diff copied to clipboard
Smaller/more performant?
I was thinking maybe it could be possible to use Set
instead to do the same thing...
A benchmark for it maybe?
var a = ['a', 'b', 'c', 'd'];
var b = ['b', 'c'];
var set = new Set(a)
b.forEach(a => set.delete(a))
Array.from(set) // => ['a', 'd']
Also in many situations it's wasteful to cast the set into an array... ppl only do it to keep the same signature and never used set in the first place
curious to see a benchmark for this native solution