Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
kind of out of order solution in Clear category for Sort Array by Element Frequency by vincent.tscherter
function frequencySort(items: any[]): any[] {
let f = {};
for (let i of items) f[i] = (f[i]||0)+1;
return items.sort((a,b) => f[b]==f[a] ? items.indexOf(a) - items.indexOf(b) : f[b]-f[a] )
}
April 23, 2020
Comments: