# 数组

1、一维数组

var x=new Array();//空数组

var x = new Array(size); //指定长度的数组

var x = new Array(element 0,element 1,……)；//指定初始值，，，，不限定存放的数据类型

2、

Eg：arr[0] = {‘你’ , ‘好’ , ‘啊’};

arr[1] = {‘你’, ‘真’，‘美’ };

arr[2] = {‘you’ , ‘are’ , ‘full’};

//遍历二维数组

for(var i=0; i>

<script type="text/javascript">
var a = new Array();
do {
var name = prompt('请输入字符串， 想要结束请输入“END"结束', 'END');//'END' 为默认填写的内容
a[a.length] = name;
} while (name != 'END');
a.length = a.length - 1;

var b = new Array();
b[0] = ["ni", "hao"];
b[1] = [3, 4];
//for (var i = 0; i < b.length; i++)
// for (var j = 0; j < b[i].length; j++)
// {
// document.write(b[i][j]+"
")
// }
for (var i in b)
for (var j in b[i])
{
document.write(b[i][j] + "
")
}
var b = new Array('小崽', '重载', '打在');

for (var i = 0; i < b.length; i++) {
}
//concat()连接
document.write(b.concat());

//join()把数组的所有元素放入一个字符
document.write(b.join("!"));
document.write("
");

//pop()删除最后一个元素并输出 删除后的数组
document.write(b.pop());

//tostring()方法;
var arr = new Array();
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"
arr[3] = "James"