function Polygon(iSliders){ //Define a polygon
this .silders=iSliders;
}
Polygon.prototype.getArea=function(){ //A method to define an area for a polygon
Return 0;
}
function Triangle(iBase ,iHeight){
Polygon.call(this,3); //Inherit the polygon object
this.base=iBase;
this.height=iHeight;
}
Triangle.prototype. getArea=function(){ //Rewrite the area method
Return 0.5*this.base*this.height;
}
var triangle=new Triangle(15,8); //Example Create a triangle
alert("number of sides:" triangle.silders);
alert("area:" triangle.getArea());