有关稳妥构造函数模式

为什么要让稳妥构造函数模式中的方法不引用this的对象呢?能稍微说下稳妥构造函数吗?

用this就有公共属性了,而且需要new,稳妥主要通过闭包进行属性访问

参考这个:http://blog.csdn.net/itpinpai/article/details/71190912

稳妥构造函数的对象就是要没有公共属性的,其方法也就不引用this。

this在js中指执行上下文,在不同的执行时代表的含义是不同的,总结归纳为三类:
1.构造函数调用:

 function A(){console.log(this)}  var a = new A(); //this指向即将被构造的对象a

2.普通函数调用:

 function a(){console.log(this)}  a() //this指向被调用函数的父级,此处为window.a,所以this是window

3.call、apply、bind调用:

 function a(){console.log(this)} var o = {}; a.call(o) //this指向o;