2018-10-16 21:32:40 +05:30

644 B

title
title
Using the Test Method

Using the Test Method

In this challenge, you are checking to see if a string contains a certain "regular expression", or regex (regular expressions). 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

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