js内置对象

 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4 <meta charset="UTF-8">
 5 <title>内置对象</title>
 6 <script>
 7     //5.Date
 8     //1)如何创建Date
 9     var d1 = new Date();
10     var d2 = new Date("2017/09/01 09:09:09");
11     console.log(d1);
12     console.log(d2);
13     //2)转换为本地格式的字符串
14     console.log(d1.toLocaleDateString());
15     console.log(d1.toLocaleTimeString());
16     //3)读取时间分量
17     var y = d1.getFullYear();
18     //月份从0开始
19     var m = d1.getMonth()+1;
20     var d = d1.getDate();
21     var today = y + "" + m + "" + d + "";
22     console.log(today);
23     
24     //6.RegExp
25     var str = "You can you up,no can no bb.";
26     //1)如何创建正则对象
27     var reg = /no/;
28     //2)test()
29     //检测字符串中是否包含与正则匹配的子串
30     console.log(reg.test(str));
31     //3)exec()
32     //普通模式下
33     //从字符串中检测出与正则匹配的第1个子串
34     console.log(reg.exec(str));
35     console.log(reg.exec(str));
36     //全局模式下
37     //第1次调用,则从字符串中检测出与正则匹配的第1个子串
38     //第n次调用,则从字符串中检测出与正则匹配的第n个子串
39     reg = /no/g;
40     console.log(reg.exec(str));
41     console.log(reg.exec(str));
42     console.log(reg.exec(str));
43     console.log(reg.exec(str));
44     
45     //7.Function
46     function sum() {
47         var s = 0;
48         if(arguments.length) {
49             for(var i=0;i<arguments.length;i++) {
50                 s += arguments[i];
51             }
52         }
53         return s;
54     }
55     
56     //页面加载时立刻调用函数
57     console.log(sum(1,2));
58     console.log(sum(3,4,5,6));
59     
60 </script>
61 </head>
62 <body>
63     
64 </body>
65 </html>
mysql
原文地址:https://www.cnblogs.com/excellent-vb/p/7729315.html