三段式(四段式)
1.在函数最前面隐式加上 this = {};
2.执行this赋值 this.xxx = xxx;
3.隐式的返回this return this;
四段式
1.在函数最前面创建一个空对象
2.把空对象赋值给this
3.执行this赋值 this.xxx = xxx;
4.隐式的返回this returnthis;
js中对象构造函数的内部原理
原文:https://www.cnblogs.com/chenhuaiyou/p/14842782.html