对象和继承
<script>
function Car(name,speed){
this.name=name;
this.speed=speed;
}
Car.prototype.showName=function(){
console.log(this.name)
}
var car=new Car("奥迪",300);
var car2=new Car("奔驰",200);
console.dir(car)
console.dir(car2)
car.showName();
// console.log(car.name)
car2.showName();
</script>
function People(name){
this.name=name;
}
People.prototype.showName=function(){
console.log(this.name);
}
function Student(){
}
Student.prototype=new People("我不李姐");
Student.prototype.study=function(){
console.log("学习");
}
var stu=new Student();
// stu.study();
// stu.showName();
// Student.prototype
// console.dir(stu.__proto__===Student.prototype)
// console.dir(Student.prototype.__proto__===People.prototype)
// console.dir(stu.__proto__.__proto__===People.prototype)
// console.dir(People.prototype.__proto__.__proto__)
console.dir(stu.__proto__.__proto__.__proto__.__proto__)
//Student.prototype
//People.prototype
//Object.prototype
//null