首先function a(){ this.a1="haha";
}
b=new a();console.log(b);可以正常運行的毋庸置疑。那么改一下a=function (){ this.a1="haha";
}
b=new a();console.log(b);同樣可以正常運行。再改一下a=function (){ this.a1=function (){ this.a2="haha";
};
e=new this.a1(); console.log(e);
}
b=new a();還是可以正常運行。但是再改一下就不行了a=function (){ this.a1=function (){ this.a2="haha";
};
}
b=new a();
e=new a.a1();chrome控制臺提示Uncaught TypeError: a.a1 is not a constructor想問一下這是什么原因?
Uncaught TypeError is not a constructor?
守著星空守著你
2018-09-11 13:33:21