From fb9cd90ee5be2925ea5aac5c3802581af0aabae5 Mon Sep 17 00:00:00 2001 From: Piyush <84092760+upwarpiyush@users.noreply.github.com> Date: Thu, 11 Jan 2024 11:40:02 +0530 Subject: [PATCH] fix(curriculum): improve instructions for Stats calculator step 22 (#53108) --- .../635090f47eb6d9563a6fed05.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635090f47eb6d9563a6fed05.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635090f47eb6d9563a6fed05.md index 07ccf949e68..320093f65a1 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635090f47eb6d9563a6fed05.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635090f47eb6d9563a6fed05.md @@ -31,7 +31,7 @@ Your `median` variable should use a ternary operator to check if the `array.leng assert.match(getMedian.toString(), /median\s*=\s*array\.length\s*%\s*2\s*===\s*0\s*\?/); ``` -If the `array.length` is even, your `median` variable should use the `getMean` function to calculate the mean of the two middle numbers. Your first argument should be the value of `sorted` at `array.length / 2`, and the second at `array.length / 2 - 1`. +If `array.length` is even, pass an array with the two middle numbers from the `sorted` array to the `getMean` function. The first item in the array argument should be the value at index `array.length / 2` from `sorted` and the second should use the value at the index `array.length / 2 - 1` from `sorted`. ```js assert.match(getMedian.toString(), /median\s*=\s*array\.length\s*%\s*2\s*===\s*0\s*\?\s*getMean\(\s*\[sorted\[array\.length\s*\/\s*2\]\s*,\s*sorted\[\s*array\.length\s*\/\s*2\s*-\s*1\]\]\)\s*\:/);