// 使用数组的 find 方法查找符合条件的第一个元素
const numbers = [1, 2, 3, 4, 5];
// 找到第一个大于 3 的元素
const found = numbers.find(element => element > 3);
console.log(found); // 输出: 4
// 解释说明:
// find 方法会遍历数组,对每个元素执行提供的函数,
// 返回第一个使该函数返回 true 的元素值。
// 如果没有找到符合条件的元素,则返回 undefined。