这里的this到底是指向哪里的.高手进来
console.log(this == Object)
onsole.log(this == obj)
console.log(this == a)
以上三个全是false.
而且this.initialize.apply(this,arguments); 这里这样写到底有什么区别或者有什么好处啊?一直想不明白
var obj = { create : function(){ return function(){ console.log(this == Object) console.log(this == obj) console.log(this == a) this.initialize.apply(this,arguments); } } } var a = obj.create(); a.prototype = { initialize :function(v) { this.name = v; }, bb : function(){ return this.name; } } var aa = new a("sd"); alert(aa.bb())