size

最后更新于:2022-04-02 00:00:28

## size + [link](./size "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L8183 "View in source.") + [npm](https://www.npmjs.com/package/lodash.size "See the npm package.") ``` _.size(collection) ``` 返回集合的长度或对象中可枚举属性的个数。 ### 参数 1. collection (Array|Object) 待处理的集合 ### 返回值 (number) 返回集合的大小 ### 示例 ``` _.size([1, 2, 3]); // => 3 _.size({ 'a': 1, 'b': 2 }); // => 2 _.size('pebbles'); // => 7 ```
';