目录

concat()

描述 (Description)

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

语法 (Syntax)

concat()方法的语法如下 -

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

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

返回值 (Return Value)

返回数组的长度。

例子 (Example)

请尝试以下示例。

<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>

输出 (Output)

alphaNumeric : a,b,c,1,2,3 
↑回到顶部↑
WIKI教程 @2018