Javascript “Not a Constructor” Exception while creating objects

后端 未结 14 1250
[愿得一人]
[愿得一人] 2020-11-27 18:15

I am defining an object like this:

function Project(Attributes, ProjectWidth, ProjectHeight)
{
    this.ProjectHeight = ProjectHeight;
    this.ProjectWidth          


        
14条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 18:46

    It is happening because you must have used another variable named "project" in your code. Something like var project = {}

    For you to make the code work, change as follows:

    var project = {} into var project1 = {}

提交回复
热议问题