Program to duplicate Vowels in String | Function to check for the Vowel ; Function to get the resultant string with vowels duplicated ; Another string to store the resultant string ; Loop to check for each character ; Driver Code ; Print the original string ; Print the resultant string
function isVowel ( ch ) { ch = ch . toUpperCase ( ) ; return ( ch == ' ' ch == ' ' ch == ' ' ch == ' ' ch == ' ' ) ; } function duplicateVowels ( str ) { let t = str . length ; let res = " " ; for ( let i = 0 ; i < t ; i ++ ) { if ( isVowel ( str [ i ] ) ) res += str [ i ] ; res += str [ i ] ; } return res ; } let str = " " ; document . write ( " " + str + " " ) ; let res = duplicateVowels ( str ) ; document . write ( " " + res + " " ) ;