Using the Test Method
Summary
- Regular expressions are used in programming languages to match parts of strings.
- The
.test()
method takes the regex, applies it to a string (which is placed inside the parentheses), and returnstrue
orfalse
.
Final Code
let myString = "Hello, World!";
let myRegex = /Hello/;
let result = myRegex.test(myString); // Change this line