In this section I will be going over some quick simple examples using _.size that should help show why it might be a useful collection method. The use of _.size is fairly easy, just pass it an Array or object and it will give the element length or the number of keys. There are some pit falls to be aware of when using _.size, or when just working with Arrays and objects in general actually so I will be touching base on that as well here. If you are more interested in vanilla js solutions I will be covering that in the next section.
When an array is passed to _.size the element length of that array is returned.
If a plain object without a length property is given to _.size the enumerable key length of that object is returned.
So when dealing with an array the element length can easily be obtained with the length property, not much to write about with that.
3.3 - Object.getOwnPropertyNames(obj).length for getting the key length of both enumerable and non-enumerable object own properties