text: Create map and calculate frequency of array of * elements using array .
code: let m = new Map ( ) ; for ( let i = 0 ; i < size ; i ++ ) { if ( m . has ( arr [ i ] ) ) { m . set ( arr [ i ] , m . get ( arr [ i ] ) + 1 ) } else { m . set ( arr [ i ] , 1 ) } }