js 对象的深层嵌套函数对对象属性的访问
var obj = {
foo: "hi",
f1: function() {
function f2(that) {
console.log(that);
}
f2(this.foo);
}
};
obj.f1(); // hi
Function.prototype.foo = "hello";
Function.prototype.f = function() {
var that = this;
setTimeout(function(that){
console.log(that.foo);
}, 100, that);
}
Function.prototype.f(); // hello

浙公网安备 33010602011771号