how to make a vowel counter in javascript
const vowelCount = str => {
let vowels = /[aeiou]/gi;
let result = str.match(vowels);
let count = result.length;
console.log(count);
};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;
}
function countVowels(str) {
return str.match(/[aeiou]/g).length;
}
Also in JavaScript:
- calling javascript file in html
- switch case in js
- js check if attribute exists
- multidimensional array javascript
- java script functions
- javacript is checkbox checked
- js match any number string
- using if statements in javascript
- vue watch
- make object readonly javascript
- how to create a constant in javascript
- form taglib in jsp
- p5 js functions
- how to code a check age function in javascript
- chrome add a javascript bookmark
- angular on back skip routes
- swift convert array to json
- petition the lord with prayer
- display array in div javascript
- jsdoc optional param
- how to execute something after ajax call
- device width javascript
- turn number into array javascript
- set value of input in javascript