If str [ i ] is between A and Z
else if ( str [ i ] . charCodeAt ( 0 ) >= ' ' . charCodeAt ( 0 ) && str [ i ] . charCodeAt ( 0 ) <= ' ' . charCodeAt ( 0 ) ) { capital [ str [ i ] . charCodeAt ( 0 ) - 65 ] = i ; } }