Incrementing the frequency of the element by 1.
if ( ! mp . has ( arr [ i ] ) ) mp . set ( arr [ i ] , 1 ) ; else { let x = mp . get ( arr [ i ] ) ; mp . set ( arr [ i ] , ++ x ) ; } } for ( let i = 0 ; i < n ; ++ i ) {