fengchuanyu 4 ヶ月 前
コミット
d5e34ec288
5 ファイル変更65 行追加2 行削除
  1. 1 0
      6_ES6/20_继承.html
  2. 1 1
      6_ES6/22_symbl.html
  3. 1 1
      6_ES6/24_map.html
  4. 33 0
      6_ES6/25_异步.html
  5. 29 0
      6_ES6/26_ajax原理.html

+ 1 - 0
6_ES6/20_继承.html

@@ -53,6 +53,7 @@
         }
         // 原型继承 可以继承到原型上的属性和方法
         Student.prototype = new Person();
+        // 修复构造函数指向问题
         Student.prototype.constructor = Student;
         let s1 = new Student('张三',18,'清华大学');
         console.log(s1.loveCoding);

+ 1 - 1
6_ES6/22_symbl.html

@@ -20,7 +20,7 @@
         obj.age = 18;
         console.log(obj);
         console.log(obj[num]);
-        
+        // Symbol不能被for in遍历
         for(let key in obj){
             console.log(key);
         }

+ 1 - 1
6_ES6/24_map.html

@@ -24,7 +24,7 @@
         wm1.set({name:"张三"},1);
         console.log(wm1);
 
-
+        
         var arr = [1,2,3,5,5,6,8,8,9];
     </script>
 </body>

+ 33 - 0
6_ES6/25_异步.html

@@ -0,0 +1,33 @@
+<!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>
+        // alert(1);
+        // console.log("hello");
+
+        // 任务队列 事件循环 event loop
+        // 异步方法 setTimeout setInterval
+        // 如果js发现异步方法无论等多久都会将它放到异步的任务队列当中,先执行同步代码
+        // setTimeout(function(){
+        //     console.log("world");
+        // },0);
+        // console.log("hello");
+
+        function foo(timer,fun){
+            setTimeout(function(){
+                fun();
+            },timer)
+        }
+
+        foo(2000,function(){
+            console.log("world");
+        });
+
+    </script>
+</body>
+</html>

+ 29 - 0
6_ES6/26_ajax原理.html

@@ -0,0 +1,29 @@
+<!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>
+
+        // ajax原理 他不能以file协议访问 他只能以http协议访问
+
+        // 第一步创建XMLHttpRequest对象
+        var xhr = new XMLHttpRequest();
+        // 第二步设置请求方式和请求地址 三个参数 第一个是请求方式 第二个是请求地址 第三个是是否异步
+        xhr.open('get',"http://shop-api.edu.koobietech.com/prod/tagProdList",true);
+        // 第三步发送请求
+        xhr.send();
+        // 第四步注册回调函数 对请求结果进行处理
+        xhr.onreadystatechange = function(){
+            if(xhr.readyState == 4 && xhr.status == 200){
+                console.log(xhr.responseText);
+            }
+        }
+
+
+    </script>
+</body>
+</html>