Assuming I have 2 arrays :
let a = [1, 2, 3]
let b = [1, 2, 3, 4, 5]
and I need a
to have the difference from b
so a = [1, 2, 3, 4, 5]
Is there a cleaner or more performant way than
a.concat(b.filter(x => !a.includes(x)))
?
Assuming I have 2 arrays :
let a = [1, 2, 3]
let b = [1, 2, 3, 4, 5]
and I need a
to have the difference from b
so a = [1, 2, 3, 4, 5]
Is there a cleaner or more performant way than
a.concat(b.filter(x => !a.includes(x)))
?