87,990
社区成员
发帖
与我相关
我的任务
分享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()) var a = return function(){
console.log(this == Object);
//console.log(this == obj)
console.log(this == a);
this.initialize.apply(this,arguments);
}
a.prototype = {
initialize :function(v) {
this.name = v;
},
bb : function(){
return this.name;
}
}
var aa = new a("sd");
alert(aa.bb())var o={k:'123'};
var t=function (){
alert(this.k+'\n'+(this==window));
};
t();
t.apply(o,[]);var t=function (){
alert(this+'\n'+(this==window));
};
t();
t.apply(t,[]);