Sort by two values prioritizing on one of them
- by Dojie
How would I sort this data by count and year values in ascending order prioritizing on the count value?
//sort this
var data = [
{ count: '12', year: '1956' },
{ count: '1', year: '1971' },
{ count: '33', year: '1989' },
{ count: '33', year: '1988' }
];
//to get this
var data = [
{ count: '1', year: '1971' },
{ count: '12', year: '1956' },
{ count: '33', year: '1988' },
{ count: '33', year: '1989' },
];