字符串 includes
单选题 入门
题目
"hello world".includes("world") 返回什么?
提示
includes 检查子字符串。
解释
"hello world".includes("world") 返回 true,因为 "world" 是子字符串。includes() 区分大小写。位置用 indexOf() 返回 6。不区分大小写检查时先转为小写:str.toLowerCase().includes(search.toLowerCase())。
相关资源
相关课程
- 数据类型
学习 JS 数据类型。
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。