如何从内部函数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