87,910
社区成员
发帖
与我相关
我的任务
分享
<script language = "javascript" type = "text/javascript">
function ImmutableRectangle(w,h) {
this.getWidth = function() { return w; }
this.getHeight = function() { return h; }
}
ImmutableRectangle.prototype.area = function() {
return this.getWidth() * this.getHeight();
}
ImmutableRectangle tt = new ImmutableRectangle(4,7)
document.write(tt.area());
// ImmutableRectangle hhh = new ImmutableRectangle(4,5);
</script>