• 复习数组和简单api


     1 <!DOCTYPE html>
     2 <html>
     3 <head lang="en">
     4     <meta charset="UTF-8">
     5     <title></title>
     6 </head>
     7 <body>
     8 <script>
     9 
    10     //定义方法
    11 //    var arr1 = [1,2,3];
    12 //    var arr2 = new Array(1,2);
    13 //
    14 //    var str1 = new String("abc");
    15 //    var str2 = "abc";
    16 
    17 //    console.log(arr1 instanceof Array);
    18 //    console.log(Array.isArray(arr2));
    19 //    console.log(Array.isArray(str1));
    20 //    console.log(str1 instanceof String);
    21 //    console.log(str2 instanceof String);
    22 
    23 //    var stu = new Stu();
    24 //    function Stu(){
    25 //
    26 //    }
    27 //    console.log(stu instanceof Stu);
    28 
    29     //数组转换
    30 //    console.log(arr1);
    31 //    console.log(arr1.toString());
    32 //    console.log(typeof arr1.toString());
    33 //    console.log(arr1.valueOf());
    34 //    console.log(typeof arr1.valueOf());
    35 
    36     //join是把数组元素用特殊方式链接成字符串(参数决定用什么链接,无参默认用逗号链接)
    37 //    var arr = ["关羽","张飞","刘备"];
    38 //    var str1 = arr.join();
    39 //    var str2 = arr.join(" ");//如果用空格的话,那么元素之间会有一个空格
    40 //    var str3 = arr.join("");//用空字符串,链接元素,无缝连接
    41 //    var str4 = arr.join("&");
    42 //    console.log(str1);
    43 //    console.log(str2);
    44 //    console.log(str3);
    45 //    console.log(str4);
    46 
    47 </script>
    48 </body>
    49 </html>
  • 相关阅读:
    UVA10891
    UVA10453
    UVA 10201
    UVA10154
    UVA11137
    UVA10617
    UVA10271
    UVA10739
    UVA10306
    节流防抖
  • 原文地址:https://www.cnblogs.com/BingBing-Deng/p/10277962.html
Copyright © 2020-2023  润新知