```class Shape {
constructor(width , height , color) {
this.width = width;
this.height = height;
this.color = color;
}
draw() {
console.log(`drowing ${this.color} color of`);
}
getArea() {
return this.width*this.height;
}
}
class Triangle extends Shape {
draw() {
super.draw();
console.log(`drowing ${this.color} color!`);
}
getArea() {
return (this.width* this.heigt) / 2;
}
}
const triangle = new Triangle(20,20,'blue');
console.log(triangle.getArea());

最后为什么会显示NaN?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-