Traversing through the string and maintaining the count of each character
for ( let i = 0 ; i < len ; i ++ ) { if ( max < count [ str [ i ] . charCodeAt ( 0 ) ] ) { max = count [ str [ i ] . charCodeAt ( 0 ) ] ; result = str [ i ] ; } } return result ; }