Skip to content

Instantly share code, notes, and snippets.

@Ynote
Created November 25, 2017 12:38
Show Gist options
  • Save Ynote/ff091364077d256fc7c452b3fc361f91 to your computer and use it in GitHub Desktop.
Save Ynote/ff091364077d256fc7c452b3fc361f91 to your computer and use it in GitHub Desktop.
[JavaScript] - Find the integer in the array which occurences number is odd
// cf. https://en.wikipedia.org/wiki/Bitwise_operation#XOR
const findOdd = arr => arr.reduce((acc, val) => acc ^ val)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment