首先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想问一下这是什么原因?
添加回答
举报
0/150
提交
取消