freeCodeCamp/guide/english/certifications/javascript-algorithms-and-d.../regular-expressions/using-the-test-method/index.md

22 lines
644 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
title: Using the Test Method
---
## Using the Test Method
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
In this challenge, you are checking to see if a string contains a certain "regular expression", or **regex** (**reg**ular **ex**pressions). You will use the `test()` method to do that.
## Hint 1:
Call the test method on `myRegex`. What do you think the argument will be?
## Spoiler Alert - Solution Ahead!
## Solution
```javascript
let myString = "Hello, World!";
let myRegex = /Hello/;
let result = myRegex.test(myString); // Change this line
```