diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507bcbfe4ede356e624395.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507bcbfe4ede356e624395.md index 28bf96fe1b6..83c39dfe47f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507bcbfe4ede356e624395.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507bcbfe4ede356e624395.md @@ -11,7 +11,7 @@ Now that you have the value of the input, you need to split it into an array of The `.split()` method takes a string and splits it into an array of strings. You can pass it a string of characters or a RegEx to use as a separator. For example, `string.split(",")` would split the string at each comma and return an array of strings. -Use a regex to split the `value` string by commas followed by any number of spaces. Store the array in an `array` variable. +Use the `/,\s*/g` regex to split the `value` string by commas. You can tweak it based on the number of spaces seperating your values. Store the array in an `array` variable. # --hints-- @@ -33,6 +33,12 @@ Your `calculate` function should assign the result of the `.split()` method to t assert.match(code.toString(), /array\s*=\s*value\.split()/); ``` +You should use `/,\s*/g` for the `split()` method's separator. + +```js +assert.match(code.toString(), /value\.split\(\s*\/,\s*\\s*\*\s*\/g\)/); +``` + # --seed-- ## --seed-contents-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507e4562cdde3a28e8de1b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507e4562cdde3a28e8de1b.md index 1ff0ee37950..bc2f0dd7342 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507e4562cdde3a28e8de1b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507e4562cdde3a28e8de1b.md @@ -17,7 +17,7 @@ array.filter(el => { The callback function needs to return a Boolean value, which indicates whether the element should be included in the new array. In this case, you want to return `true` if the element is not `NaN` (not a number). -However, you cannot check for equality here, because `NaN` is not equal to itself. Instead, you can use the `Number.isNaN()` method, which returns `true` if the argument is `NaN`. +However, you cannot check for equality here, because `NaN` is not equal to itself. Instead, you can use the `isNaN()` method, which returns `true` if the argument is `NaN`. Add a callback function to your `.filter()` method that returns `true` if the element is not `NaN`. @@ -29,10 +29,10 @@ Your `.filter()` method should have a callback which accepts `el` as a parameter assert.match(calculate.toString(), /numbers\.filter\(\(?\s*el\s*\)?\s*=>|numbers\.filter\(function\s*\(?el\)\s*\{/) ``` -Your callback function should use `!` and `Number.isNaN()` to check if `el` is NOT `NaN`. +Your callback function should use `!` and `isNaN()` to check if `el` is NOT `NaN`. ```js -assert.match(calculate.toString(), /!(Number\.)?isNaN\(\s*el\s*\)/); +assert.match(calculate.toString(), /!\s*(Number\.)?isNaN\(\s*el\s*\)/); ``` Your callback function should return elements that are not `NaN`.