find only vowels in string Javascript code example
Example: find only vowels in string Javascript
//This function accepts a string and
//returns a new string that (matches all vowels) and displays these vowels as such
//Using built in method and RegEx
//Hope this helps:)
function is vowelsOnly(str) {
return str.match(/[aeiou]/ig, '');
}
console.log(vowelsOnly("hello world"));//['e', 'o', 'o']
console.log(vowlesOnly("SHOUT it out"));//['O','U','i','o','u']