I want to write a function with a switch statement to count the number of occurrences of any two vowels in succession in a line of text. For example, in the sentence
For example:
Original string = “Pleases read this application and give me gratuity”.
Such occurrences in string ea, ea, ui.
Output: 3
function findOccurrences() {
var str = "Pleases read this application and give me gratuity";
var count = 0;
switch (str) {
case 'a':
count++;
case 'A':
count++
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U':
return 1;
default:
return 0;
}
}
findOccurrences();