Number of words in a camelcase sequence | Function to find the count of words in a CamelCase sequence ; driver program
function countWords ( str ) { let count = 1 ; for ( let i = 1 ; i < str . length - 1 ; i ++ ) { if ( str [ i ] >= ' ' && str [ i ] <= ' ' ) count ++ ; } return count ; } let str = " " ; document . write ( countWords ( str ) ) ;