js练习构造函数和原型对象的继承方式

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript">

var shape={
type:"triangle",
getType:function(){
return this.type;
}
};
function Triangle(a,b,c)
{
this.a=a;
this.b=b;
this.c=c;
}
Triangle.prototype=shape;
Triangle.prototype.getPerimeter=function()
{
return (this.a)*(this.b)*(this.c);
};
var t=new Triangle(4,5,6);
alert(t.getPerimeter());
alert(t.getType());
</script>


</head>
<body>

</body>
</html>