| array
|-Definition method
|--1, New Array ();
|----Empty Array
|------var attr = new Array ();
|------lenght:0
|------_proto_: Array []
|----An array of length
|------var attr new Array (10);
|------lenght:10
|------_proto_: Array []
|----An array with an initial value
|------var attr = new Array ("Zhang San", 20, "male");
|------Array (3) ["Zhang San", 20, "male"]
|------0: "Zhang San"
|------1: "20"
|------2: "Male"
|------Lenght:3
|------_proto_: Array []
|--2, [];
|----Empty Array
|------var attr = [];
|------lenght:0
|------_proto_: Array []
|----An array with an initial value
|------var attr = ["Zhang San", 20, "male"];
|------0: "Zhang San"
|------1: "20"
|------2: "Male"
|------Lenght:3
|------_proto_: Array []
var New Array (); var New Array (5); var New Array ("Zhang San", 20, "male"); var attr = []; var attr = [5]; var attr = ["Zhang San", 20, "Male"];console.log (attr);
|-array traversal
|--1, for Loop
|--2, for (in)
var person = ["John Doe", 28, "male", "unmarried"]; for (var i = 0;i < person.length;i++ ) { alert (person[i]);} var person = ["John Doe", 28, "male", "unmarried"]; for (var in person ) { alert (person[i]);}
|-array Additions
|--1, for Loop
|--2,. push
var attr = []; for (var i = 0;i < 5;i++) { = i; Attr.push (i);} alert (attr);
Definition, traversal, and addition of 0513JS arrays