Get average value of items in a javascript array
Sun Jan 05 2020 19:39:47 GMT+0000 (Coordinated Universal Time)
Saved by @bezequi #javascript #webdev #arrays #math
In this function, we first use reduce() to reduce all values in our array to a single sum. Once we have the sum we simply divide this value by the length of the array. The result is the average value which then gets returned.
https://codeburst.io/javascript-arrays-finding-the-minimum-maximum-sum-average-values-f02f1b0ce332
Comments
@rahulhsol - Sat May 17 2025 04:41:02 GMT+0000 (Coordinated Universal Time)<a href="https://www.google.com/">AHERF CODE</a> HTML [url=https://www.google.com/]BB CODE [/url] BB (BIT BYTE) https://www.google.com/ URLS <a href="https://google.com/">google</a> |<br />[/q] http://www.google.com/ URL WITHOUT S [[https://www.google.com/|Google Search]] [a link](google.com) google search engine [Google](https://www.google.com) google3 [http://www.google.com|google4 ] [http://www.google.com google5 ] [url=https://www.google.com]google[/url] [google7|http://www.google.com] "google8":www.google.com [google10](http://www.google.com/) [http://www.google.com|google11] [Lighthouse12](http://lighthouseapp.com/ "Lighthouse12") [13google->http://www.google.com/]