101 exercises #43

// Write a function definition named isVowel that takes in value and returns true if the value is a, e, i, o, u in upper or lower case.

I’ve tried a few different versions of code that supposed to work but The problem still does not return solved. thoughts?

const isVowel = (s: string) => !!s.match(/[aeiou]/ig)
1 Like

or …

const iVowel = (s: string) => /^[aeiou]$/gi.test(s)

does this work in javascript as is? is there something im missing?

In js it would be this:

const iVowel = s => /^[aeiouy]+$/gi.test(s)
1 Like

Okay, so I can make that code work. now my question is why does it work that way? would I use the same syntactical sugar if I wanted to change the rule to //return true if string has a vowel?