Created
September 30, 2016 17:50
-
-
Save cakesmith/d7e85c70461ab70a350f7df340e8fb77 to your computer and use it in GitHub Desktop.
ES6 Diff Set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function diffSet(a, b) { | |
let x = new Set([...a].filter(n => !b.has(n))); | |
let y = new Set([...b].filter(n => !a.has(n))); | |
return new Set([...x, ...y]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment