Created
February 5, 2020 13:09
-
-
Save ChrisDobby/020612f10caf65f96559efa95ea031c2 to your computer and use it in GitHub Desktop.
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 evenWord(word) { | |
let charCounts = [...word].reduce( | |
(charCount, char) => ({ | |
...charCount, | |
[char]: charCount[char] ? charCount[char] + 1 : 1, | |
}), | |
{}, | |
); | |
return Object.entries(charCounts).filter(([_, count]) => count % 2 !== 0).length; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment