jsArrayStats Demo

by netdesign

HTML

<script src="https://raw.github.com/netdesign/jsArrayStats/master/jsArrayStats.js"></script>

JavaScript

/*
This is a simple demo of jsArrayStats
*/

// declare an Array
var array = [1, 2, 3, 3, 1, 2, 8, 7];

// create a new arrayStats instance
var myArrStats = new arrayStats(array);

// setting precision
myArrStats.precision = 4;

// the .mean() method calculates the arithmetic mean of the Array
alert(myArrStats.mean());