filter: 用于过滤,相当于循环并进行if判断,返回符合条件的项组成的新数组
const arr = [1,2,3,4,5];
const newArr = arr.filter((item) => item>3 );// newArr = [4,5]
map:循环每一项,并进行操作,返回新数组
const arr = [1,2,3,4,5];
const newArr = arr.map((item) => item+1 );// newArr = [2,3,4,5,6]
some :循环,判断有没有符合的项,符合后结束循环,返回boolean类型
const arr = [1,2,3,4,5];
const test1 = arr.some((item) => item>3 );// test1 = true
const test2 = arr.some((item) => item>6 );// test2 = false