A cleaner approach in ES6 is the following solution.
var a1 = ['a', 'b']; var a2 = ['a', 'b', 'c', 'd']; Difference
a2.filter(d => !a1.includes(d)) // gives ["c", "d"] Intersection
a2.filter(d => a1.includes(d)) // gives ["a", "b"] Disjunctive Union (Symmetric Difference)
[ ...a2.filter(d => !a1.includes(d)), ...a1.filter(d => !a2.includes(d)) ]