本文共 600 字,大约阅读时间需要 2 分钟。
字符串中include
Check if a string includes the value of the string passed as parameter..
检查字符串是否包含作为参数传递的字符串的值。
'JavaScript'.includes('Script') //true'JavaScript'.includes('script') //false'JavaScript'.includes('JavaScript') //true'JavaScript'.includes('aSc') //true'JavaScript'.includes('C++') //false
includes()
also accepts an optional second parameter, an integer which indicates the position where to start searching for:
includes()
还接受可选的第二个参数,该整数表示开始搜索的位置:
'a nice string'.includes('nice') //true'a nice string'.includes('nice', 3) //false'a nice string'.includes('nice', 2) //true
翻译自:
字符串中include
转载地址:http://toqgb.baihongyu.com/