fengchuanyu 4 mesi fa
parent
commit
fc144e73f5

+ 22 - 0
js复习/17_日期对象.html

@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+</head>
+<body>
+    <script>
+        var date = new Date();
+
+        // 获取年
+        var year = date.getFullYear();
+        // 获取月
+        var month = date.getMonth()+1;
+        // 获取日
+        var day = date.getDate();
+        console.log(year, month, day);
+        
+    </script>
+</body>
+</html>

+ 9 - 0
js复习/5_分支判断.html

@@ -95,6 +95,15 @@
         //     console.log("错误");
         // }
 
+        var a = 10;
+        var b = 20;
+        // if(a>b){
+        //     console.log(a);
+        // }else{
+        //     console.log(b);
+        // }
+        // 三目运算符 ?:
+        a>b?console.log(a):console.log(b);
     </script>
 </body>
 </html>

+ 42 - 0
js复习/综合题3_选择判断.html

@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+</head>
+<body>
+    <script>
+        // var a = 10;
+        // a = "hello";
+        // // var str = [];
+        // // var num;
+        // b = a + 1;
+        // console.log(b);
+
+        // var a = 1 + 2;
+        // var b = 1 + "a";
+        // console.log(a,b)
+
+        // var c = "a";
+        // var d = "e";
+
+        // var e = 1,f = 2;
+        // console.log(e,f)
+
+        // var g;
+        // if(g){
+        //     console.log("正确");
+            
+        // }else{
+        //     console.log("错误");
+        // }
+        
+        if("2">"19"){
+            console.log("正确");
+        }else{
+            console.log("错误");
+        }
+    </script>
+</body>
+</html>