如何從內部函數c1訪問container.a?如何從內部函數訪問外部範圍?
var container = {
a : 'blah',
b : function(){
console.log(this.a); // prints 'blah'
},
c : {
// how to access container.a from here?
c1: function(){
// and here?
}
}
}
不能'c'使用'this'? –
'this'將返回'Window'對象的內部c – fromvega
如何重組它,以便您可以將'container'對象傳遞到'c'中。 – Chris