Skip to content

Instantly share code, notes, and snippets.

@SethVandebrooke
Last active May 14, 2021 21:00
Show Gist options
  • Save SethVandebrooke/8a7a3b36b2f25ad1e8fc83b92b1aae3d to your computer and use it in GitHub Desktop.
Save SethVandebrooke/8a7a3b36b2f25ad1e8fc83b92b1aae3d to your computer and use it in GitHub Desktop.
Get the number of syllables in a word or sentence
function getSyllables(word) {
return word.replace(/e$/,'').match(/tion|sion|[aeiou]{3,}|[aeou]+|[aeiou]/g).length;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment