//1.参数是具体指
var arr = [1,2,3];
console.log(arr.concat(4,5)); // [1, 2, 3, 4, 5]
//2.参数是数组对象
var arr1 = [1,2,3,4];
var arr2 = ["pink","black"];
var arr2_2 = "pink";
var arr3= arr1.concat(arr2);
var arr3_2= arr1.concat(arr2_2);
console.log(arr3); //[1, 2, 3, 4, "pink", "black"]
console.log(arr3_2); //[1, 2, 3, 4, "pink"]
//合并数组方法二:
var arr4 = $.merge(arr, arr2);
var arr4_2 = $.merge(arr1, arr2_2);
console.log(arr4);//[1, 2, 3, "pink", "black"]
console.log(arr4_2);//[1, 2, 3, 4, "p", "i", "n", "k"]
//数组转字符串:
var arry = [1,2,3,4,5];
var join = arry.join(",");
console.log(join);//1,2,3,4,5
//字符串转数组:
var str = "abc,abcd,aaa";
var split = str.split(",");// 在每个逗号,处进行分割
console.log(split);//["abc", "abcd", "aaa"]
var str1 = "hello,world";
var split1= str1.split(""); //括号为空时,会返回没个字符,包括符号
console.log(split1);//["h", "e", "l", "l", "o", ",", "w", "o", "r", "l", "d"]