To store the
let occ = new Map ( ) ; for ( let i = 0 ; i < len ; i ++ ) if ( occ . has ( arr [ i ] ) ) { occ . set ( arr [ i ] , occ . get ( arr [ i ] ) + 1 ) ; } else { occ . set ( arr [ i ] , 1 ) ; }