var Shape = function(width, height) { var self = this; self.area = function() { return width * height; } return self;};var shape = Shape(20, 30);area;为什么这里area变成了全局的?
1 回答
智慧大石
TA贡献1946条经验 获得超3个赞
Shape(20,30)===>window.Shape(20,30)
this此时为window
对应的window.area = function(){}
添加回答
举报
0/150
提交
取消