The _.size() function is used to find the size of an array, i.e. the number of elements in the array. It is mostly used to find the number of elements in an array.
_.size( list )
Parameters: This function accepts single parameter list which is used to hold the list of items.
Return values: This function returns a value which is the size of the passed array.
Passing an array to the _.size() function: The ._size() function takes the element from the list one by one and calculate the size by starting from zero and increment by one as it passes through each element. Passing an array which has first the property name and then the element as one element of the array. If property name will not mentioned then the _.size() function will not work.
Passing an array of large number of property to _.size() function: Passing a large array to the _.size() function. The _.size() function takes an array which has 4 properties, ‘category’, ‘title’, ‘value’ and ‘id’. Then apply _.size() function on this array and console.log() will display the final result.
Passing a structure to the _.size() function: First declare an array (here array is ‘people’). Then just simply pass this array to the _.size() function and console.log() will display the final answer.
Passing only one property array to the _.size() function: Declare an array which contains one property. The array ‘users’ is defined with one property ‘num’. Then simply pass this array to _.size() function by mentioning the array’s name inside the _.size() function. Finally, console.log() will display the final answer.
- jQuery | size() with Examples
- HTML | DOM Input URL size Property
- How to set the div height to auto-adjust to background size?
- CSS | font-size-adjust Property
- CSS | tab-size Property
- HTML | size Attribute
- CSS | font-size Property
- CSS | background-size Property
- How to change the maximum upload file size in PHP ?
- How to style icon color, size, and shadow by using CSS ?
- Set the size of background image using CSS ?
- How to set checkbox size in HTML/CSS?
- HTML | DOM Input Email size Property
- HTML | DOM Input Password size Property
- HTML | DOM Input Text size Property
- HTML | DOM Input Search size Property
- HTML | DOM Select size Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.