From 17a7daa4d0f8118533662e5e688241df211a13f6 Mon Sep 17 00:00:00 2001 From: greggubarev Date: Mon, 15 Oct 2018 21:51:33 +0400 Subject: [PATCH] Javascript: Added hint to Check for All or None (#19255) Added hint to Check for All or None (https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none and https://guide.freecodecamp.org/certifications/javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none/) --- .../check-for-all-or-none/index.md | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/client/src/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none/index.md b/client/src/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none/index.md index 02d0429257..5088b31e6d 100644 --- a/client/src/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none/index.md +++ b/client/src/guide/english/certifications/javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none/index.md @@ -1,10 +1,20 @@ ---- -title: Check for All or None ---- + ## Check for All or None -This is a stub. Help our community expand it. - -This quick style guide will help ensure your pull request gets accepted. - + +## The Problem: + +We need to change the regex ```favRegex``` to match both the American English (favorite) and the British English (favourite) version of the word. + + ## Solution: + + ```js +let favWord = "favorite"; +let favRegex = /favou?rite/; // Change this line +let result = favRegex.test(favWord); +``` + + ## Explanation: + +In this regex (```/favou?rite/```), we specify the possible existence of an element (```u```) with a question mark, ```?```.