DEV Community

Cesar Del rio
Cesar Del rio

Posted on • Updated on

#11 - Vowel remover CodeWars Kata (8 kyu)

Instructions

Create a function called shortcut to remove all the lowercase vowels in a given string.

Examples

"hello" --> "hll"
"codewars" --> "cdwrs"
"goodbye" --> "gdby"
"HELLO" --> "HELLO"


Note: Don't worry about uppercase vowels.

My solution:

function shortcut (string) {
  return string.split(/[aeiou]/g).join('')
}

Enter fullscreen mode Exit fullscreen mode

Explanation

I first splitted the string using a RegEx expression, that splitted every vocal from the string, and after that I just joined the array

Comment how would you solve this kata and why? πŸ‘‡πŸ€”

My Github
My twitter
Solve this Kata

Oldest comments (0)