본문 바로가기
알고리즘/Codewars

[Codewars] Vowel remover (8 kyu) / JavaScript

by fluss 2023. 3. 20.

https://www.codewars.com/kata/5547929140907378f9000039

 

Codewars - Achieve mastery through coding practice and developer mentorship

A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages!

www.codewars.com

 

DESCRIPTION:

Create a function called shortcut to remove the lowercase vowels (a, e, i, o, u ) in a given string.

 

Examples

"hello"     -->  "hll"
"codewars"  -->  "cdwrs"
"goodbye"   -->  "gdby"
"HELLO"     -->  "HELLO"
  • don't worry about uppercase vowels
  • y is not considered a vowel for this kata

 

코드

function shortcut (string) {
  return string.replace(/[aeiou]/ig, "");
}

댓글