Check for All or None, can't pass the test

Tell us what’s happening:

The : Your regex should match “favourite” task isn’t accepted. But why?
Your code so far


let favWord = "favorite";
let favRegex = /favo?rite/; // Change this line
let result = favRegex.test(favWord);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none

Thx for your help in advance

Hi @LeeLandHillysLloyd

Because you’re regex isn’t testing for the British variant of the word.

From the description:

Change the regex favRegex to match both the American English (favorite) and the British English (favourite) version of the word.

Ah, thanks, it worked :sweat_smile:

let favWord = "favorite";
let favRegex = /favou?rite/; // Change this line
let result = favRegex.test(favWord);
1 Like