@@ -53,6 +53,7 @@
}
// 原型继承 可以继承到原型上的属性和方法
Student.prototype = new Person();
+ // 修复构造函数指向问题
Student.prototype.constructor = Student;
let s1 = new Student('张三',18,'清华大学');
console.log(s1.loveCoding);
@@ -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);
@@ -24,7 +24,7 @@
wm1.set({name:"张三"},1);
console.log(wm1);
+
var arr = [1,2,3,5,5,6,8,8,9];
</script>
</body>
@@ -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);
+ function foo(timer,fun){
+ setTimeout(function(){
+ fun();
+ },timer)
+ }
+ foo(2000,function(){
+ console.log("world");
+ });
+ </script>
+</body>
+</html>
@@ -0,0 +1,29 @@
+ // 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);