From 80ba943ca3fd868f63a66562c190e933dfef0d59 Mon Sep 17 00:00:00 2001 From: Hassaan Pasha Date: Mon, 10 Feb 2020 05:43:43 +0500 Subject: [PATCH] fix: fixed regex for validating newlines in for loops (#38180) --- ...e-the-filter-method-to-extract-data-from-an-array.english.md | 2 +- .../use-the-map-method-to-extract-data-from-an-array.english.md | 2 +- .../use-the-reduce-method-to-analyze-data.english.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.english.md index b15631aa30..59645d4c07 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.english.md @@ -40,7 +40,7 @@ tests: - text: Your code should use the filter method. testString: assert(code.match(/\.filter/g)); - text: Your code should not use a for loop. - testString: assert(!code.match(/for\s*?\(.+?\)/g)); + testString: assert(!code.match(/for\s*?\([\s\S]*?\)/g)); - text: 'filteredList should equal [{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}].' testString: 'assert.deepEqual(filteredList, [{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]);' diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.english.md index cb88cbc80f..74948db906 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.english.md @@ -41,7 +41,7 @@ tests: - text: The watchList variable should not change. testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron"); - text: Your code should not use a for loop. - testString: assert(!removeJSComments(code).match(/for\s*?\(.*?\)/)); + testString: assert(!removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); - text: Your code should use the map method. testString: assert(code.match(/\.map/g)); - text: ratings should equal [{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}]. diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.english.md index 193ce6808e..568f6fdb2f 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.english.md @@ -65,7 +65,7 @@ tests: - text: The getRating(watchList) should equal 8.675. testString: assert(getRating(watchList) === 8.675); - text: Your code should not use a for loop. - testString: assert(!code.match(/for\s*?\(.*\)/g)); + testString: assert(!code.match(/for\s*?\([\s\S]*?\)/g)); - text: Your code should return correct output after modifying the watchList object. testString: assert(getRating(watchList.filter((_, i) => i < 1 || i > 2)) === 8.55);