let user {name: "wang",age: 3,run: function () {console.log(this.name " run ......");}
};let bob {name: "bob"
};// bob 的 原型是 user
bob.__proto__ userbob.run() // bob run ......
console.log(bob.age) // 3
console.log(bo…
class继承
class 关键字是在ES6引入的
ES6之前的写法:
function Student(name) {this.name name
}
// 给Student新增一个方法
Student.prototype.hello function () {alert(Hello)
}ES6的写法:
// 定义一个 学生的 类
class Student1{constructor(…