深入数组
一.如何创建一个数组
Array构造器
var a =Array(8)
使用对象字面量
var b = [];
b.length = 8
使用Array.of
Array.of(8) //[8]
二.如何判断数组
var a = [];
//1
a instanceof Array;//true
//2
a.constructor === Array;//true
//3
Array.prototype.isPrototypeOf(a);//true
//4
Object.prototype.toString.apply(a) === '[object Array]';//true
//5
Object.getPrototype(a) === Array.prototype;//true
三.数组自带的方法
1.改变自身
pop、push、reverse、shift、sort、splice、unshift、fill、copyWithin
2.不改变自身
concat、join、slice、toString、toLocalString、indexOf、lastIndexOf、
四.数组遍历
forEach、every、some、filter、map、reduce、reduceRight