Created
February 4, 2020 08:35
-
-
Save mbarto/ca4b80ddd550f629e74db061904309db to your computer and use it in GitHub Desktop.
evenWord implementation
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
const isOdd = x => x % 2 === 1; | |
const toArray = s => s.split(""); | |
const alpha = toArray("abcdefghijklmnopqrstuvwxyz"); | |
const occurrences = (s, c) => toArray(s).filter(x => x === c).length; | |
const evenWord = s => alpha.map(c => occurrences(s, c)).filter(isOdd).length; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment