Count occurrences of maximum element in A [ ]
let max1 = Number . MIN_VALUE , count1 = 0 ; for ( let i = 0 ; i < size1 ; i ++ ) { if ( a [ i ] > max1 ) { max1 = a [ i ] ; count1 = 1 ; } else if ( a [ i ] == max1 ) { count1 ++ ; } }