たまに使いたくなるけど、書き方忘れるので備忘録。
変数
const baseArray = [1,2,3,4,5,6,7,8,9,10]
const target1 = [10,9,8,7,6,5,4,3,2,1]
const target2 = [1,2,3]
const target3 = [11]
完全一致(every)
baseArray.every((num) => target1.includes(num))
> true
baseArray.every((num) => target2.includes(num))
> false
baseArray.every((num) => target3.includes(num))
> false
部分一致(some)
baseArray.some((num) => target1.includes(num))
> true
baseArray.some((num) => target2.includes(num))
> true
baseArray.some((num) => target3.includes(num))
> false