Skip to content

Instantly share code, notes, and snippets.

@mbarto
Created February 4, 2020 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbarto/ca4b80ddd550f629e74db061904309db to your computer and use it in GitHub Desktop.
Save mbarto/ca4b80ddd550f629e74db061904309db to your computer and use it in GitHub Desktop.
evenWord implementation
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