find,findIndex【查找数组中第一个符合条件的值和该值的索引】
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>find方法</title>
</head>
<body><script type="text/javascript">var ary = [{id: 1,name: '张三'}, {id: 2,name: '李四'}];let target = ary.find(item => item.id == 3);let targetIndex = ary.findIndex(item => item.id == 3);console.log(target,targetIndex)</script>
</body>
</html>
includes【数组中是否包含某值】
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>includes方法</title>
</head>
<body><script type="text/javascript">let ary = ["a", "b", "c"];let result = ary.includes('a')console.log(result)result = ary.includes('e')console.log(result)</script>
</body>
</html>