Using the Test Method2

Tell us what’s happening:

This tests out to me but I can’t pass the challenge. What’s the issue?

Your code so far


let myString = "Hello, World!";
let myRegex = /Hello/;
myRegex.test(myString);

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

you changed something you shouldn’t have.

just reset the code and redo the fix without removing the let statement in the 3rd line.

1 Like

let myString = “Hello, World!”;
let myRegex = /Hello/;
let myRegex.test(myString); // Change this line

This isnt working - what I am doing wrong?

You need to assign the returned value of the test method to the variable result.

Isnt that what I am doing? SOrry just following the syntax of the example.

you are not really.
let myString = “Hello, World!”;

this is how you assign something. Notice the equal sign?
Look at your statement. Does it have an equal sign? Does it have a variable?

You are right thanks!

1 Like