underscore:get elements counts of a array
生活随笔
收集整理的這篇文章主要介紹了
underscore:get elements counts of a array
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
get elements counts of a array by underscore
source code:
function get_counts_of_the_elements_in_an_array(array){var count = _.groupBy(array);var new_array= [];for(key in count){new_array.push({'value':key,'count':count[key].length}) } ????return _.sortBy(new_array,function(obj){return obj.count}); }
example code:
轉載于:https://my.oschina.net/coderman/blog/182333
總結
以上是生活随笔為你收集整理的underscore:get elements counts of a array的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Mallet机器语言工具包-入门测试
- 下一篇: 嵌入式要学什么