Freecodecamp: [beta] Improve Instruction for "Regular Expressions: Match Single Character with Multiple Possibilities"

Created on 2 Feb 2017  ·  3Comments  ·  Source: freeCodeCamp/freeCodeCamp

Challenge match-single-character-with-multiple-possibilities has an issue.
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36.



let quoteSample = "Beware of bugs in the above code; I have only proved it correct, not tried it.";
let vowelRegex = /[aeiou]/ig; // Change this line
let result = quoteSample.match(vowelRegex); // Change this line

This challenge asks me to "count the number of vowels". This made me think I should add .length to the expression evaluating to my result variable. Adding .length fails the tests, while leaving it out lets me complete the challenge.

Since the challenge isn't testing for a numerical value in the result variable, I suggest that we change the instruction and first test case to only ask campers to find all vowels.

To fix this, update the final sentence to

...to find all vowels in the string quoteSample.

and update the message of the first test case:
assert(result.length == 25, 'message: You should find all 25 vowels.);

help wanted learn

All 3 comments

@Greenheart ah I must have been a little lazy to mislead people in the instructions 😆 This change sounds good to me 👍

@erictleung It happens to the best of us! :wink:

I'll do this too, since the change sounds similar to the other two..

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robwelan picture robwelan  ·  3Comments

ar5had picture ar5had  ·  3Comments

danielonodje picture danielonodje  ·  3Comments

trashtalka3000 picture trashtalka3000  ·  3Comments

Tzahile picture Tzahile  ·  3Comments