Sentence Case of a given Camel cased string | Function to return the original string after converting it back from camelCase ; Print the first character as it is ; Traverse the rest of the characters one by one ; If current character is uppercase print space followed by the current character in lowercase ; Else print the current character ; Driver code
function getOrgString ( s ) { document . write ( s [ 0 ] ) ; var i = 1 ; while ( i < s . length ) { if ( s [ i ] . charCodeAt ( 0 ) >= " " . charCodeAt ( 0 ) && s [ i ] . charCodeAt ( 0 ) <= " " . charCodeAt ( 0 ) ) document . write ( " " + s [ i ] . toLowerCase ( ) ) ; else document . write ( s [ i ] ) ; i ++ ; } } var s = " " ; getOrgString ( s ) ;