From cd43ed8b56258cf213ac03c62dea4cee2a17ba24 Mon Sep 17 00:00:00 2001 From: atomiks Date: Thu, 14 Dec 2017 20:24:07 +1100 Subject: [PATCH] Use explicit default value --- snippets/standard-deviation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/standard-deviation.md b/snippets/standard-deviation.md index 442052761..f07cb4f4c 100644 --- a/snippets/standard-deviation.md +++ b/snippets/standard-deviation.md @@ -6,7 +6,7 @@ of the values to determine the standard deviation of an array of numbers. Since there are two types of standard deviation, population and sample, you can use a flag to switch to population (sample is default). ```js -const standardDeviation = (arr, usePopulation) => { +const standardDeviation = (arr, usePopulation = false) => { const mean = arr.reduce((acc, val) => acc + val, 0) / arr.length; return Math.sqrt( arr.reduce((acc, val) => acc.concat(Math.pow(val - mean, 2)), [])