数组
基础知识
const meArray = [1, 2, 3, [4, 5, 6], 7]
const meArray = new Array(4)
let meArrayLength = meArray.length
Array.of(1, 3);
Array.isArray(meArray)
meArray.join("-");
Array.from('love', (item) => itme + 'good', this)
管理元素
meArray.push('向军大叔', 'houdunren')
meArray.pop()
meArray.shift()
meArray.unshift()
meArray.fill("后盾人", 1, 3)
meArray.slice(1, 3)
meArray.splice()
合并拆分
meArray.join('StringA');
meString.split('StringA');
meArray.concat(ArrayA, ArrayB)
meArray.copyWithin(NumberA, NumberB, NumberC)
查找元素
meArray.indexOf(MixedA, numberB)
meArray.lastIndexOf(MixedA, numberB)
meArray.find(function (currentValue, index, arr) { }, this)
meArray.findindex(function (currentValue, index, arr) { }, this)
数组排序
meArray.reverse()
meArray.sort((元素 A, 元素 B) => 元素 A.Number - 元素 B.Number)
循环遍历
for (let i = 0; i < meArray.length; i++) { }
for (const key in meArray) { }
for (const value of meArray) { }
meArray.forEach((currentValue, index, arr) => { }, this);
迭代器
meArray.keys()
meArray.values()
meArray.entries()
优雅的方法
meArray.every(function (currentValue, index, arr) { }, this)
meArray.some(function (currentValue, index, arr) { }, this)
meArray.filter(function (currentValue, index, arr) { }, this)
meArray.map((valeu, key, meArray) => { return value }, this)
meArray.reduce(function (total, currentValue, currentIndex, arr) { }, initialValue)