JavaScript數組concat()方法返回一個新的數組包含數組加入了兩個或更多數組
語法
array.concat(value1, value2, ..., valueN);
下麵是參數的詳細資訊:
-
valueN : 數組和/或值來連接到所得數組。
返回值:
返回數組的長度。
例子:
<html>
<head>
<title>JavaScript Array concat Method</title>
</head>
<body>
<script type="text/javascript">
var alpha = ["a", "b", "c"];
var numeric = [1, 2, 3];
var alphaNumeric = alpha.concat(numeric);
document.write("alphaNumeric : " + alphaNumeric );
</script>
</body>
</html>
這將產生以下結果:
alphaNumeric : a,b,c,1,2,3
