0

I am writing a function that takes a string and returns a new string with all vowels removed.

function disemvowel(str) {
  let vowels = /[aeiou]/gi

  return (
    str.split('').filter(chr => !vowels.test(chr)).join('')
  )
}

There's a working pen here (https://codepen.io/Tr4pSt3R/pen/ydyxNZ)

I am taking this challenge here (https://www.codewars.com/kata/disemvowel-trolls/train/javascript) just to skill up JavaScript.

Here are the test results:

Test Results:
Test Passed: Value == 'Ths wbst s fr lsrs LL!'
Expected: 'N ffns bt,\nYr wrtng s mng th wrst \'v vr rd', instead got: 'N ffns bt,\nYur wrtng s mng th wrst \'v vr rad'
Expected: 'Wht r y,  cmmnst?', instead got: 'Wht r yu,  cmmnst?'

I get that message when I run it against Codewar's site but, it works perfectly fine when I run it on CodePen.

Can anyone point out what I am be doing wrong please?

Jones Agyemang
  • 1,230
  • 16
  • 15

0 Answers0