From 03ec4b6fedca5af0bacdefad9943a8dcf0f08c22 Mon Sep 17 00:00:00 2001 From: Agung Saputra <107747646+Agung1606@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:07:22 +0700 Subject: [PATCH] fix(curriculum): give useful hint for step 50 of statistics calculator if you are missing the starting value of the reduce. (#57145) --- .../6352fcb156834128001ea945.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md index 67425590a93..84c24df2e82 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md @@ -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*\)/); ```