//1. 循环一个数组, 通过push方法将元素添加到另一个数组 var a = [1,2,3]; var b = [4,5,6]; for(var i in b){ a.push(b[i]); } console.log("concat: " + a); //2. 数组连接 concat var a = [1,2,3]; var b = [4,5,6]; var c = a.concat(b); //[1,2,3,4,5,6] console.log("concat: " + c); //3. 拼接 splice var a = [1,2,3,4,5]; a.splice(2,1,6,7); //[ 1,2,6,7,4,5] console.log("splice: " + a); //4. 互换两个位置 var a = [1,2,3,4,5,6]; var up = a[2]; var cur = a[3]; a[2] = cur; a[3] = up; console.log("concat: " + a); //5. 字符串包含