Answers for "find only vowels in string Javascript"

-1

find vowels in string javascript

var name = userInput[0];
    var count =0;
  	function findvowel(name)
    {
    	var vowel = ['a','e','i','o','u','A','E','I','O','U'];
      	for(i=0;i<name.length;i++)
      	{
      		if(vowel.includes(name[i]))
        	{
          		count++;
        	}
      	}
      	return count;
    }
    
  console.log(findvowel(name));
Posted by: Guest on December-06-2020
0

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']
Posted by: Guest on March-29-2021

Code answers related to "find only vowels in string Javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language