Open this example in the interactive library
Source code
const before = new Set(["cup", "pen"]),
after = new Set(["pen", "pad"]);
console.log([...before.symmetricDifference(after)]);
Sample output
[ 'cup', 'pad' ]

Open this example in the interactive library
const before = new Set(["cup", "pen"]),
after = new Set(["pen", "pad"]);
console.log([...before.symmetricDifference(after)]);
[ 'cup', 'pad' ]