548 B
548 B
title, localeTitle
| title | localeTitle |
|---|---|
| Using the Test Method | 使用测试方法 |
使用测试方法
在这个挑战,你检查是否字符串包含一定的“正则表达式”,或正则表达式 (REG ular 前 pressions)。您将使用test()方法来执行此操作。
提示1:
在myRegex上调用测试方法。您认为这个论点是什么?
剧透警报 - 提前解决!
解
let myString = "Hello, World!";
let myRegex = /Hello/;
let result = myRegex.test(myString); // Change this line