Answers for "javascript Write an algorithm to find the number of vowels in a given word. For example; the user has entered-umbrella so your program should give the number;3 that is the number of vowels in the word umbrella."

1

how to make a vowel counter in javascript

function countVowels(str) {
  return str.match(/[aeiou]/g).length;
}
Posted by: Guest on April-09-2020
0

how to make a vowel counter in javascript

function getCount(str) {
let vowelList = 'AEIOUaeiou'
let vowelsCount = 0;

 for(var i = 0; i < str.length ; i++)
  {
    if (vowelList.indexOf(str[i]) !== -1)
    {
      vowelsCount += 1;
    }
  }
  return vowelsCount;
}
Posted by: Guest on April-05-2020

Code answers related to "javascript Write an algorithm to find the number of vowels in a given word. For example; the user has entered-umbrella so your program should give the number;3 that is the number of vowels in the word umbrella."

Code answers related to "Javascript"

Browse Popular Code Answers by Language