Count the pairs of vowels in the given string | Function that return true if character ch is a vowel ; Function to return the count of adjacent vowel pairs in the given string ; If current character and the character after it are both vowels ; Driver Code
function isVowel ( ch ) { switch ( ch ) { case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : return true ; default : return false ; } } function vowelPairs ( s , n ) { let cnt = 0 ; for ( let i = 0 ; i < n - 1 ; i ++ ) { if ( isVowel ( s [ i ] ) && isVowel ( s [ i + 1 ] ) ) cnt ++ ; } return cnt ; } let s = " " ; let n = s . length ; document . write ( vowelPairs ( s , n ) ) ;