Generation

generate functionSat, 11 Feb 2023

Write a function to count the no. of vowels in a given string,consider both lower case,upper case letters Input-string Output:- No.of vowels (count even if a vowel is repeated)

Script function vowel_count(str1) { var vowel_list = 'aeiouAEIOU'; var vcount = 0; for(var x = 0; x < str1.length ; x++) { if (vowel_list.indexOf(str1[x]) !== -1) { vcount += 1; } } return vcount; } console.log(vowel_count("The quick brown fox"));

Questions about programming?Chat with your personal AI assistant