Stores the count of frequencies of all the array elements
let freq = new Map ( ) ; for ( let i = 0 ; i < arr . length ; i ++ ) { if ( freq . has ( arr [ i ] ) ) freq . set ( arr [ i ] , freq . get ( arr [ i ] ) + 1 ) ; else freq . set ( arr [ i ] , 1 ) ; }