Using the Test Method help

Tell us what’s happening:

Your code so far


let myString = "Hello, World!";
let myRegex = /Hello/;
let result = myRegex; // 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:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method

they gave you an example of what to do already:

let testStr = "freeCodeCamp";
let testRegex = /Code/;
testRegex.test(testStr);
// Returns true

You will struggle a lot in this section if you do not follow the examples carefully.

Do you see how they use test? They use it on a ‘testRegex’ and give it a parameter which is a test string…

I guess the problem is that even when you write the right solution the test aren’t getting passed. The following code solves the challenge…

let myString = "Eleanor Roosevelt";
let myRegex = /(Franklin|Eleanor).*Roosevelt/g;
let result = myRegex.test(myString);

… but 2/5 of the tests fail.
Apologies for my grammar and spelling.

I would that in this case the issue is not the tests… I have answered you in the other thread you created