greggubarev 2018-10-15 21:51:33 +04:00 committed by Todd Chaffee
parent 5eccd7cd4f
commit 17a7daa4d0
1 changed files with 17 additions and 7 deletions

View File

@ -1,10 +1,20 @@
---
title: Check for All or None
---
## Check for All or None
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
## 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, ```?```.