Stores the frequencies of array elements
var count = new Map ( ) ; arr . forEach ( element => { if ( count . has ( element ) ) count . set ( element , count . get ( element ) + 1 ) else count . set ( element , 1 ) } ) ;