javascript的数组之find()

find()方法返回数组中第一个满足回调函数测试的第一个元素的值。否则返回undefined

const arr1 = [1, 2, 3, 4, 6, 9];

let found = arr1.find(e => e > 5); // 6

参数:

第一个:执行的回调函数

第二个:指定回调函数的this对象

原文地址:https://www.cnblogs.com/huanqiuxuexiji/p/9157567.html