Return the number of values in the list.

返回元素列表的长度

1 _.size({one : 1, two : 2, three : 3});
2 => 3

源码:

1  _.size = function(obj) {
2     return _.isArray(obj) ? obj.length : _.keys(obj).length;
3   };

 

 

posted on 2012-04-20 23:28  himanhimao  阅读(164)  评论(0编辑  收藏  举报