ES6 - 数组方法 concat()

concat() 方法返回一个由该数组与两个或多个数组连接而成的新数组。

语法

array.concat(value1, value2, ..., valueN);

参数

  • valueN − 要连接到结果数组的数组和/或值。

返回值

返回一个新数组。

示例

var alpha = ["a", "b", "c"];
var numeric = [1, 2, 3];
var alphaNumeric = alpha.concat(numeric);
console.log("alphaNumeric : " + alphaNumeric );

输出

alphaNumeric : a,b,c,1,2,3