Tell us what’s happening:
Your code so far
let extractStr = "Extract the word 'coding' from this string.";
let codingRegex = /coding/i; // Change this line
let result = extractStr; extractStr.match(codingRegex);// Change this line
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.
Link to the challenge:
is this some kind of bug or I am doing something wrong?
Challenge expects the match result be stored with variable
result, so how do you put the result on
I see your code copy the
extractStr instead which is not correct.
You need to keep the return value of
extractStr.match(codingRegex); to result. But your code doesn’t do that! it actually rejects the return value.
let result = extractStr.match(codingRegex);
If you still have issues, reveal the spoiler above, but try to fix it first yourself.
Keep going on great work, happy programming.
With this “You need to keep the return value of extractStr.match(codingRegex); to result. But your code doesn’t do that! it actually rejects the return value.” I understood what stupid thing I did thanks man
in this challenge it is a little bit difference from the previous challenges .
(.match( ) )in match extract we are going to apply the method on a string(will be inside the parentheses) and pass in the regex inside the parentheses
but (.test( ) ) takes the regex, applies it to a string (which is placed inside the parentheses)