_.size

_.size(collection)

Gets the size of collection by returning its length for array-like values or the number of own enumerable string keyed properties for objects.

Since

0.1.0

Arguments

  1. collection (Array|Object|string): The collection to inspect.

Returns

(number): Returns the collection size.

Example

1
2
3
4
5
6
7
8
_.size([1, 2, 3]);
// => 3
  
_.size({ 'a': 1, 'b': 2 });
// => 2
  
_.size('pebbles');
// => 7
doc_Lodash
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.