1、push方法,往数组的末尾添加值,可以是一个或者多个值,中间通过,分隔;
<script type="text/javascript">
var arr = new Array(1, 2, 3);
arr.push(4, 5)
alert(arr);
</script>
输出:1,2,3,4,5
2、join方法,连接数组元素,中间有分隔符;
<script type="text/javascript">
var str = arr.join(" ");
alert(str);
</script>
输出:1 2 3
3、splice方法,增加删除元素
<script type="text/javascript">
var arr = new Array(6);
arr[0] = "George";
arr[1] = "John";
arr[2] = "Thomas";
arr[3] = "James";
arr[4] = "Adrew";
arr[5] = "Martin";
arr.splice(0,1, "test");
alert(arr);
</script>
输出:test,John,Thomas,James,Adrew,Martin
4、concat方法,连接两个或多个数组;
<script type="text/javascript">
var arr = new Array(1, 2, 3);
var arr1 = new Array("a", "b", "c");
var arr2 = new Array(true, true, true);
alert(arr.concat(arr1, arr2));
</script>
输出:1,2,3,a,b,c,true,true,true