![](/img/trans.png)
[英]JavaScript this refers to window instead of object inside function
[英]this refers to inside function on javascript
var a = function foo(){
this.confusing = 'hell yeah';
function boo(){
this...
}
}
在foo()
内部调用的boo()
函数中,是否将为foo()
元素定义this
函数?
里面的boo
功能, this
将参考boo
,如果你愿意函数对象,或“窗口”。 如果您熟悉,这类似于python中作用域的堆叠。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.