```var test=['alpha','beta',3,false];

①数组的构建：

1.利用数组的构造函数

`var test=new Array();`

```var test1=new Array(3);//指定大小
var test2=new Array('demo1','demo2',222);//指定内容```

1.利用数组字面量表示法：

`var test=['alpha','beta',3,false];`

```	var test=new Array('demo1','demo2',333);
console.log(test.toString());//'demo1','demo2',333
test[3]='我是第四个';
console.log(test.toString());//'demo1','demo2',333,我是第四个```

### ②监测数组

```	var test=new Array('demo1','demo2',333);
if(test instanceof Array){
alert(test is a array);//test is a array
}
//该方法支持ie9+
if(Array.isArray(test)){
alert(test is a array);//test is a array
}```

### ③ 转换方法

```	var person1 = {
toLocaleString: function() {
return alpha;
},
toString: function() {
return Beta;
}

}
var person2 = {
toLocaleString: function() {
return alpha;
},
toString: function() {
return Alpha;
}

}
var people = [person1, person2];

```	var people=['alpha','Beta',3,'names'];
console.log(people.join('||'));```

### ④栈方法

```	var newArr=[1,2,3,4,5];
newArr.push(6);
newArr.pop();

### ⑤队列方法

```	var newArr=[1,2,3,4,5];
newArr.shift();
newArr.push(6);

JavaScript还提供了一个unshift方法，也就是说在队列的前面添加一个元素并且是长度加1.

```	var newArr=[1,2,3,4,5];
newArr.shift();
newArr.unshift(6,7);//6,7,2,3,4,5

### ⑥重排序方法

```	var newArr=[1,2,3,4,5];
var secArr=[1,3,5,7,2,4];
newArr.reverse();
secArr.sort();

```	var secArr=[1,3,5,7,2,4,11];
secArr.sort();

```	var secArr=[1,3,5,7,2,4,11];
secArr.sort(compare);