One by one check for each character if it is a numeric character
for ( let i = 0 ; i < s . length ; ++ i ) { if ( s [ i ] . charCodeAt ( 0 ) >= ' ' . charCodeAt ( 0 ) && s [ i ] . charCodeAt ( 0 ) <= ' ' . charCodeAt ( 0 ) ) { num_found_so_far += s [ i ] ; } else if ( num_found_so_far . length > 0 ) {