字符串匹配器
预测输出 简单
题目
这段测试代码打印什么?
代码
test("str", () => {
expect("hello world").toMatch(/world/);
});
// Result?
提示
字符串匹配正则 /world/。
解释
toMatch 检查字符串是否匹配正则。"hello world" 含 "world",匹配 /world/。断言通过。
相关资源
相关课程
- 断言
学习断言。
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。