Array的方法

Array的方法 #

  • 1.遍历foreach
  • 2.转换map、reduce
  • 3.扁平化flat
  • 4.过滤filter
  • 5.查找indexOf、includes、some、every、
  • 6.排序sort
  • 7.添加删除push、pop、shift、unshift
  • 8.拼接join、concat

includes适合比较基本类型,对象适合用some判断是否包含在数组中