<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>组合继承</title>
</head>
<body>
<script>
function Humans(name){
this.name=name;
this.clothing=["trousers","dress","jacket"];
}
Humans.prototype.sayName=function(){
alert(this.name);
};
function Man(name,age){
Humans.call(this,name);
this.age=age;
}
Man.prototype=new Humans();
Man.prototype.sayAge=function(){
alert(this.age);
};
var man1=new Man("mary",38)
man1.clothing.push("coat");
alert(man1.clothing);
man1.sayName();
man1.sayAge();
var man2=new Man("tom",26);
alert(man2.clothing);
man2.sayName();
man2.sayAge();
</script>
</body>
</html>