Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@davidsharp
Created July 19, 2021 09:39
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 davidsharp/62d4726fb097032f7d4f8cc913158d59 to your computer and use it in GitHub Desktop.
Save davidsharp/62d4726fb097032f7d4f8cc913158d59 to your computer and use it in GitHub Desktop.
// sorts the vowels in a (lowercase) word
(
s=>(r=/[aeiou]/g,x=s.match(r).sort(),c=0,s.replace(r,_=>x[c++]))
)('crocodile') // -> crecidolo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment