Skip to content

Instantly share code, notes, and snippets.

@brianfiszman
Last active July 12, 2018 21:07
Show Gist options
  • Save brianfiszman/65fef644770b4a3eabb4a1effeb185f6 to your computer and use it in GitHub Desktop.
Save brianfiszman/65fef644770b4a3eabb4a1effeb185f6 to your computer and use it in GitHub Desktop.
Obtain a letter if 's' match a regexp
const getLetter = s =>
s.match(/^[aeiou]/)
? "A"
: s.match(/^[bcdfg]/)
? "B"
: s.match(/^[hjklm]/)
? "C"
: "D";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment