averagejs
v1.1.1
Published
A JavaScript library that can calculate the average such as mean, median, mode from a bunch of numbers.
Maintainers
Readme
AverageJS
A JavaScript library that can calculate the average such as mean, median, mode from a bunch of numbers.
Installation
Add this script tag to your HTML code
<script src="https://cdn.jsdelivr.net/npm/[email protected]/script.min.js"></script>Useage
Get the Mean of a bunch of numbers.
let inputNumbers = [2, 9, 4, 6, 8];
let result = getMean(inputNumbers);
console.log(result); // 5Get the Median of a bunch of numbers.
let inputNumbers = [5, 4, 2, 6, 3];
let result = getMean(inputNumbers);
console.log(result); // 4Get the Mode of a bunch of numbers.
let inputNumbers = [1, 1, 2, 2, 3];
let result = getModes(inputNumbers);
console.log(result); // 1,2