includes可用于查找数组和字符串是否包含某元素,包含返回true,否则返回false
1、数组
let arr = [1,2,3,4,5]
arr.includes[4] // true
arr.includes[9] // false
2、字符串
var str = "Hello world"
str.includes("world") // true
str.includes("wo") // true
str.includes("c") // false
只有字符串包含,即返回true
标签:arr,false,includes,js,str,字符串,用法,true From: https://www.cnblogs.com/axingya/p/17807001.html