ran npm run tdd & generated TDD
This commit is contained in:
7
test/standardDeviation/standardDeviation.js
Normal file
7
test/standardDeviation/standardDeviation.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = (arr, usePopulation = false) => {
|
||||
const mean = arr.reduce((acc, val) => acc + val, 0) / arr.length;
|
||||
return Math.sqrt(
|
||||
arr.reduce((acc, val) => acc.concat((val - mean) ** 2), []).reduce((acc, val) => acc + val, 0) /
|
||||
(arr.length - (usePopulation ? 0 : 1))
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user