|数组
|-定义方式|--1、new Array();|----空数组|------var attr = new Array();|------lenght:0|------_proto_: Array []|----有长度的数组|------var attr new Array(10);|------lenght:10|------_proto_: Array []|----带有初始值的数组|------var attr = new Array("张三",20,"男");|------Array(3) [ "张三", 20, "男" ]|------0: "张三"|------1: "20"|------2: "男"|------lenght: 3|------_proto_: Array []|--2、[];|----空数组|------var attr = [];|------lenght:0|------_proto_: Array []|----带有初始值的数组|------var attr = ["张三", 20, "男"];|------0: "张三"|------1: "20"|------2: "男"|------lenght: 3|------_proto_: Array []var attr = new Array();var attr = new Array(5);var attr = new Array("张三",20,"男");var attr = [];var attr = [5];var attr = ["张三",20,"男"];console.log(attr);
var person = ["李四",28,"男","未婚"];for(var i = 0;i < person.length;i++ ){ alert(person[i]);}var person = ["李四",28,"男","未婚"];for(var i in person){ alert(person[i]);}
var attr = [];for(var i = 0;i < 5;i++){ attr[i] = i; attr.push(i);}alert(attr);