1 var name = userInput[0];
2 var count =0;
3 function findvowel(name)
4 {
5 var vowel = ['a','e','i','o','u','A','E','I','O','U'];
6 for(i=0;i<name.length;i++)
7 {
8 if(vowel.includes(name[i]))
9 {
10 count++;
11 }
12 }
13 return count;
14 }
15
16 console.log(findvowel(name));
1//This function accepts a string and
2//returns a new string that (matches all vowels) and displays these vowels as such
3//Using built in method and RegEx
4//Hope this helps:)
5
6function is vowelsOnly(str) {
7return str.match(/[aeiou]/ig, '');
8}
9
10console.log(vowelsOnly("hello world"));//['e', 'o', 'o']
11console.log(vowlesOnly("SHOUT it out"));//['O','U','i','o','u']