findとfindIndexの使い方
参考記事
https://ginpen.com/2018/12/04/array-find/
find(配列内の指定した数値や文字を取得)
const a = 'blue'
const ary = ['red', 'green','blues', 'blue', 'yellow', 'white','blue-bird']
// aと同じ要素があれば、抜き出します。
const result = ary.find(item => item === a)
console.log(result)
// result = 'blue'
findIndex(配列のインデックス(何番目か)を取得)
const ar = ['red', 'green','blues', 'blue', 'yellow', 'white','blue-bird']
const index = ar.findIndex(item =>item === 'red')//配列の0番から始まって何番目にあるかを抽出。見つからないと−1を返す
console.log(index)//結果:0(red以外を検索していたら、green:1, blues:2, blue:3 ,,,)