首页 > 技术文章 > 判断一个数组是否包含一个指定的值 includes-ES6

anans 2019-03-26 11:37 原文

var array1 = [1, 2, 3];

console.log(array1.includes(2));  // true
console.log(array1.includes(2, 5));  // false


array1.includes(value, index);

// value 要搜索的值

// index 从什么位置开始搜索

 img

推荐阅读