To handle upper case letters
ch = ch . toLowerCase ( ) ; if ( ch == " " ch == " " ch == " " ch == " " ch == " " ) vowels ++ ; else consonant ++ ; } else if ( ch >= " " && ch <= " " ) digit ++ ; else specialChar ++ ; } document . write ( " " + vowels + " " ) ; document . write ( " " + consonant + " " ) ; document . write ( " " + digit + " " ) ; document . write ( " " + specialChar + " " ) ; }