array-avg

Calculate the average of an array of numbers.

Usage no npm install needed!

<script type="module">
  import arrayAvg from 'https://cdn.skypack.dev/array-avg';
</script>

README

array-avg NPM version Build Status

Calculate the average of an array of numbers.

Install with npm

$ npm i array-avg --save

Usage

var avg = require('array-avg');

avg([1, 2, 3, 4, 5]);
//=> 3

avg(['1', '2', 3, '4', 5]);
//=> 3

avg([1, 'foo', 2, 4, {}, 5]);
//=> 2

Related projects

array-sum: Add up all of the numbers in an array of numbers. Works when non-numbers are… more | homepage

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Brian Woodward

License

Copyright © 2015 Brian Woodward Released under the MIT license.


This file was generated by verb-cli on September 23, 2015.