22 lines
644 B
Markdown
22 lines
644 B
Markdown
|
---
|
||
|
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
|
||
|
```
|