Counting occurrences of three different characters ' a ' , ' b ' and ' c ' in str
let count = new Array ( 3 ) ; for ( let i = 0 ; i < 3 ; i ++ ) { count [ i ] = 0 ; } for ( let i = 0 ; i < n ; ++ i ) count [ str [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] ++ ;