Answer the question
In order to leave comments, you need to log in
Why can't I sort the collection using the sortBy method of underscore?
var collection = [ { city: 'томск', count: '1185' },
{ city: 'йошкар ола', count: '1276' },
{ city: 'самара', count: '14936' },
{ city: 'ульяновск', count: '1544' },
{ city: 'курган', count: '1785' },
{ city: 'брянск', count: '1841' },
{ city: 'курск', count: '1847' },
{ city: 'липецк', count: '2318' },
{ city: 'уфа', count: '2614' },
{ city: 'красноярск', count: '2671' },
{ city: 'ростов +на дону', count: '2879' },
{ city: 'чебоксары', count: '3013' },
{ city: 'ижевск', count: '3136' },
{ city: 'воронеж', count: '3217' },
{ city: 'санкт петербург', count: '3234' },
{ city: 'тверь', count: '3451' },
{ city: 'новосибирск', count: '3723' },
{ city: 'рязань', count: '3914' },
{ city: 'иркутск', count: '3928' },
{ city: 'казань', count: '4004' },
{ city: 'омск', count: '4279' },
{ city: 'оренбург', count: '4329' },
{ city: 'барнаул', count: '4353' },
{ city: 'ярославль', count: '4881' },
{ city: 'челябинск', count: '5179' },
{ city: 'волгоград', count: '5751' },
{ city: 'тула', count: '5800' },
{ city: 'саратов', count: '5925' },
{ city: 'пенза', count: '6731' },
{ city: 'магнитогорск', count: '684' },
{ city: 'екатеринбург', count: '7224' },
{ city: 'нижний новгород', count: '8179' },
{ city: 'киров', count: '8381' },
{ city: 'пермь', count: '8789' },
{ city: 'тюмень', count: '9346' } ]
console.log(_.sortBy(collection, 'count'));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question