To handle lower case
ch = ch . toUpperCase ( ) ; console . log ( ch ) ; return ( ! ( ch == " " ch == " " ch == " " ch == " " ch == " " ) && ch . match ( / [A-Z] / i ) ) ; } function totalConsonants ( str ) { var count = 0 ; for ( var i = 0 ; i < str . length ; i ++ )