站长资讯网
最全最丰富的资讯网站

es6数组方法有什么

es6数组方法有:“from()”、“of()”、“copyWithin()”、“fill()”、“find()”、“findIndex()”、“includes()”、“entries()”、“keys()”、“values()”等。

es6数组方法有什么

本教程操作环境:windows7系统、ECMAScript 6版、Dell G3电脑。

传统Array 对象方法

  • toSource() 返回该对象的源代码。
  • toString() 把数组转换为字符串,并返回结果。
  • toLocaleString() 把数组转换为本地数组,并返回结果。
  • valueOf() 返回数组对象的原始值
修改原数组 不修改原数组
push, pop concat
unshift,shift join
sort slice
reverse indexOf(),lastIndexOf()
splice forEach
copyWithin map
fill filter
some
every
reduce,reduceRight
includes
finde,findIndex
entries(),keys(),values()

修改原数组

  • push() 向数组的末尾添加一个或
赞(0)
分享到: 更多 (0)