Counvar occurrences of three different characters ' a ' , ' b ' and ' c ' in str
var count = Array . from ( { length : 3 } , ( _ , i ) => 0 ) ; for ( var i = 0 ; i < n ; ++ i ) { count [ str . charAt ( i ) . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] ++ ; }