← Back to challenges

Replace Vowel with Another Character

JavaScriptHardstringsregexlanguage_fundamentals

Instructions

Create a function that takes a string and replaces the vowels with another character.

  • a = 1
  • e = 2
  • i = 3
  • o = 4
  • u = 5

Examples

replaceVowel("karachi") ➞ "k1r1ch3"

replaceVowel("chembur") ➞ "ch2mb5r"

replaceVowel("khandbari") ➞ "kh1ndb1r3"

Notes

The input will always be in lowercase.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Harshad Number