Array.prototype.includes()
String.prototype.includes()
在数组的includes中,同时只能比较单个成员,不能够检测多个
例如:
var array1 = [1, 2, 3];
console.log(array1.includes([2,3]));
// expected output: false
如果要同时判断2和3只能将此数组循环遍历再逐一判断
另注意:对象数组不能使用includes进行检测
在String运用includes时,如果不考虑大小写的因素,可将相检测的两边字符串同时转换为小写(String.toLocaleLowerCase)/大写(String.toLocaleUpperCase)然后在进行检测