Regular Expressions - Using the Test Method

The explanation is not correct for this exercise. there is no mentioning using a let result in the question. Should this be filed as a bug?

Your code so far

let myString = "Hello, World!";
let myRegex = /Hello/;
let result = myRegex.test(myString);
// no explanation on why we need let result now.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36

Challenge: Regular Expressions - Using the Test Method

Link to the challenge:

The code example appears to be incomplete compared to the test because to check you would need to console.log(result)to get the output of true or false.

I don’t understand what you are trying to say.
by just putting console.log(myRegex.test(myString));
You can get the value true(which is the correct answer) although the exercise does not accept it as correct.

first edit: I think I understand where you’re going. There is indeed a difference between the example and the correct response.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.