arr.find
let arr = [1,2, 3, 4, 5, 6, 7, 8, 9];
console.log(arr.find(function (value, index, arr) {
return value > 10;
}))
console.log(arr.find(function (value, index, arr) {
return value > 5;
}))
结果
undefined
6
let arr = [1,2, 3, 4, 5, 6, 7, 8, 9];
console.log(arr.find(function (value, index, arr) {
return value > 10;
}))
console.log(arr.find(function (value, index, arr) {
return value > 5;
}))
结果
undefined
6