首先
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
想问一下这是什么原因?
 守着星空守着你
守着星空守着你 
					侃侃无极
 随时随地看视频慕课网APP
随时随地看视频慕课网APP
相关分类