← Back to challenges

Dashed Vowels

JavaScriptHardstringslogicformattingregex

Instructions

Create a function that takes a string and returns dashes on the left and right side of every vowel (a e i o u).

Examples

dashed("Sample") ➞ "S-a-mpl-e"

dashed("Carpe Diem") ➞ "C-a-rp-e- D-i--e-m"

dashed("Fight for your right to party!") ➞ "F-i-ght f-o-r y-o--u-r r-i-ght t-o- p-a-rty!"

Notes

  • A string can contain uppercase and lowercase vowels.
  • Y is not considered a vowel.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Finish the Sentence You're On!