es3,es5原型
function Animal(){
this.name=function(){
alert('Aaa')
}
}
function Dag(){
this.bark=function(){
alert('Ha shiqi')
}
}
Dag.prototype=new Animal()
var hashiqi=new Dag()
hashiqi.bark()
hashiqi.name()
es6原型
{
class Animal {
constructor(name) {
this.name=name
}
eat(){
alert(this.name+'eat')
}
}
class Dog extends Animal{
constructor(name){
super(name)
this.name=name
}
say(){
alert(this.name+'say')
}
}
const dog=new Dog('hasiqi')
dog.say()
}