Check for All or None

Check for All or None
0

#1

Tell us what’s happening:

i could not understand the theory and the use of "? "symbol

Your code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0.

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


#2

It matches zero or one occurrence of the symbol it’s attached to. Taking the regex from the example, /colou?r/ will match either 'color' or 'colour', but it won’t match 'colouur' (because it has two uu in it)