Standard Deviation

Calculate the standard deviation of an array of numbers.

Code

General
const mean = arr.reduce((a, b) => a + b) / arr.length;
return Math.sqrt(arr.reduce((sq, n) => sq + Math.pow(n - mean, 2), 0) / arr.length);

Parameters

Array of numbers

Browser·fetch() may be limited by CORS

More JavaScript Snippets