数组方法大全
函数中,js所传递的参数可以用arguments[i](注意别漏了s)来取,在argumengts[]数组中的顺序和你传递的顺序相同。 通过arguments.length()可以检查有多少个参数,arguments[]的定义也是双向绑定的,所以修改arguments中的值,会直接影响到传递参数的值
1. 访问对象的属性,除了可以用《点表示法》之外,还可以用《方括号表示法》,后者有更多的功能,比如,当属性中包含【数字】项时,包含空格时,想使用变量表示属性名时,即,如下所示:

2. 判断是不是数组有一下几种方法(数组是特殊的对象);

3. toString() 方法和join()方法;
如果数组存在undefined项,在结果中将以空字符串表示;
如果参数相同,join方法和split方法是反操作,如join(‘’)和split(‘’)

4. 数组的队列方法; 先进先出 。 Push()和shift()方法

5. 数组的栈方法; 先进后出。 push()和pop()方法

6. 除了以上外,ECMAScript还提供了unshift() 方法,其与 shift() 相反,在数组的顶部增加项。
我们可以使用unshift()和pop()来实现反向队列操作 (灵活组合)

7. 数组的重排序主要有两种方法,reverse() 和 sort()

8. 数组的任意追加 concat()函数;

ES-6 中,可利用延展操作符实现类似功能
9. 数组的截取 slice()方法(切片)。
如果 slice() 参数为负数,表示从后往前。slice() 也可用于截取字符串

10. 神奇的splice()方法:删除--插入--替换 splice()接受1个,2个 或3个参数

11. 数组的位置方法:indexOf()和lastIndexOf(); 后者从后往前找(注意只是查找顺序区分,别把数组下标弄反了)

12. 数组的迭代方法:every(), some(), filter(), forEach(), map()

13. 数组的归并方法; reduce(), reduceRight(); (后者和前者只是方向区别)

先写到这里,希望能帮到大家