Storing frequencies
let m = new Map ( ) ; for ( let i = 0 ; i < b . length ; i ++ ) { if ( m . has ( b [ i ] ) ) { m . set ( b [ i ] , m . get ( b [ i ] ) + 1 ) ; } else { m . set ( b [ i ] , 1 ) ; } } let v = [ ] ; for ( i of m ) { v . push ( i [ 1 ] ) ; }