es6數(shù)組方法有:“from()”、“of()”、“copyWithin()”、“fill()”、“find()”、“findIndex()”、“includes()”、“entries()”、“keys()”、“values()”等。
本教程操作環(huán)境:windows7系統(tǒng)、ECMAScript 6版、Dell G3電腦。
傳統(tǒng)Array 對象方法
- toSource() 返回該對象的源代碼。
- toString() 把數(shù)組轉換為字符串,并返回結果。
- toLocaleString() 把數(shù)組轉換為本地數(shù)組,并返回結果。
- valueOf() 返回數(shù)組對象的原始值
修改原數(shù)組 | 不修改原數(shù)組 |
---|---|
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() |
修改原數(shù)組
- push() 向數(shù)組的末尾添加一個或