mode is the index with maximum count
let mode = 0 ; let k = count [ 0 ] ; for ( let i = 1 ; i < t ; i ++ ) { if ( count [ i ] > k ) { k = count [ i ] ; mode = i ; } } document . write ( " " + mode ) ; }