Shouldn't have passed this challenge, but i still did for some off reason

Regular Expressions: Extract Matches

let extractStr = "Extract the word 'coding' from this string.";

let codingRegex = /coding/; // Change this line

let result = extractStr.match('coding'); // Change this line

Should it not be .match(codingRegex)? It still passes the tests even in this method

link to the challenge Learn Regular Expressions: Extract Matches | freeCodeCamp.org

it works because

If [the argument] is a non- RegExp object, it is implicitly converted to a RegExp by using new RegExp(regexp) .

[source]

also none of the tests specifically check the argument of match


Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

1 Like