0
点赞
收藏
分享

微信扫一扫

数组原生方法

  • 数组和字符串的转换方法:toString()toLocalString()join() 其中 join() 方法可以指定转换为字符串时的分隔符。
  • 数组尾部操作的方法 pop() push()push 方法可以传入多个参数。
  • 数组首部操作的方法 shift()unshift() 重排序的方法 reverse() sort()sort() 方法可以传入一个函数来进行比较,传入前后两个值,如果返回值为正数,则交换两个参数的位置。
  • 数组连接的方法 concat() ,返回的是拼接好的数组,不影响原数组。
  • 数组截取办法 slice(),用于截取数组中的一部分返回,不影响原数组。
  • 数组插入方法 splice(),影响原数组查找特定项的索引的方法,indexOf()lastIndexOf() 迭代方法 every()some()filter()map()forEach()方法
  • 数组归并方法 reduce() reduceRight() 方法
  • 改变原数组的方法fill()pop()push()shift()splice()unshift()reverse()sort()
  • 不改变原数组的方法concat()every()filter()find()findIndex()forEach()indexOf()join()lastIndexOf()map()reduce()reduceRight()slice()some()


举报

相关推荐

0 条评论