码迷,mamicode.com
首页 > 编程语言 > 详细

4日6日--数组的其他使用方法

时间:2017-04-06 14:21:17      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:拼接   nbsp   style   script   oct   class   另一个   asc   zha   

  新建一个数组

  1、修改数组元素的间隔符。

  2、使用concat对数组进行拼接。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数组的其它方法1</title>
    <script type="text/javascript">
        var arr=["mike","jerry","tom"];
        var str=arr.join();
        console.log(str);
        str=arr.join("-");
        console.log(str);
        str=arr.join("");
        console.log(str);
     //新建另一个数组
var arr2=["lisi","wang","zhang"];
     //arr与arr2与"aa","bb",组成新的数组
var allName=arr.concat(arr2,["aa","bb"]); console.log(allName); console.log(arr); </script> </head> <body> </body> </html>

 

4日6日--数组的其他使用方法

标签:拼接   nbsp   style   script   oct   class   另一个   asc   zha   

原文地址:http://www.cnblogs.com/xinxinxinxin/p/6673196.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!