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:
Agung Saputra
2024-12-18 22:07:22 +07:00
committed by GitHub
parent 648cc58d68
commit 03ec4b6fed

View File

@@ -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*\)/);
```