The avg() method returns the average of all the items in a collection.
- Collect.js can be installed via NPM:
npm install --save collect.js
- You can also use CDN of collect.js
Parameters: The collect() takes one argument that is converted into the collection and then avg() function is applied on it, which can take element if you apply it on the collection of objects.
Return Value: Returns a number which is average of the collection.
Example 1: Here collect = require(‘collect.js’) is used to import the collect.js library into the file.
Example 2: Array of objects.
- jQuery | css() Method
- jQuery | add() method with Example
- Lodash | _.xor() Method
- Lodash | _.nth() Method
- Lodash | _.take() Method
- Collect.js | all() Method
- TypeScript | toExponential() Method
- Lodash | _.zipWith() Method
- Lodash | _.zipObject() Method
- Lodash | _.find() Method
- Lodash | _.clone() Method
- Lodash | _.sampleSize() Method
- Lodash | _.head() Method
- Lodash | _.remove() Method
- Lodash | _.pullAt() Method
- Lodash | _.pullAll() Method
- Lodash | _.pull() Method
- Lodash | _.sortedLastIndex() Method
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.