手册地址:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array
find()
find() 方法返回数组中满足提供的测试函数的第一个元素的值。否则返回 undefined
语法:arr.find(callback[, thisArg])
callback
在数组每一项上执行的函数,接收 3 个参数:
1.element
当前遍历到的元素。
2.index可选
当前遍历到的索引。
3.array可选
数组本身。
thisArg可选
执行回调时用作this的对象。
findIndex()
findIndex() 方法返回数组中满足提供的测试函数的第一个元素的索引。否则返回-1。
语法:arr.findIndex(callback[, thisArg])