Javascript “Not a Constructor” 创建对象时的异常
2022-08-30 04:18:43
我正在定义一个这样的对象:
function Project(Attributes, ProjectWidth, ProjectHeight) {
this.ProjectHeight = ProjectHeight;
this.ProjectWidth = ProjectWidth;
this.ProjectScale = this.GetProjectScale();
this.Attributes = Attributes;
this.currentLayout = '';
this.CreateLayoutArray = function()
{....}
}
然后,我尝试创建一个这样的实例:
var newProj = new Project(a,b,c);
但是会引发此异常:
Project is not a constructor
可能出了什么问题?我在谷歌上搜索了很多,但我仍然无法弄清楚我做错了什么。