mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-17 16:00:50 -04:00
fix(curriculum): give useful hint for step 50 of statistics calculator if you are missing the starting value of the reduce. (#57145)
This commit is contained in:
@@ -33,6 +33,12 @@ assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDiffere
|
||||
|
||||
Your `reduce` callback should return the sum of `acc` and `el`.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDifferences\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*return\s*acc\s*\+\s*el\s*;\s*\}/);
|
||||
```
|
||||
|
||||
You are missing the starting value of the `reduce`.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDifferences\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*return\s*acc\s*\+\s*el\s*;\s*\}\s*,\s*0\s*\)/);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user