简体   繁体   English

这是指javascript的内部函数

[英]this refers to inside function on javascript

var a = function foo(){
    this.confusing = 'hell yeah';
    function boo(){
        this...
    } 
}

In function boo() which call inside of foo() , will this be defined for foo() element? foo()内部调用的boo()函数中,是否将为foo()元素定义this函数?

Inside the boo function, this will reference the boo function object, or "window" if you will. 里面的boo功能, this将参考boo ,如果你愿意函数对象,或“窗口”。 This is similar to the stacking of scopes in python, if you're familiar with that. 如果您熟悉,这类似于python中作用域的堆叠。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 JavaScript 这是指 window 而不是 ZC1C425268E68385D1AB5074C17A94F1 内部的 object - JavaScript this refers to window instead of object inside function 引用自身的javascript函数 - javascript function that refers to itself Javascript:为什么私有函数里面的“this”指的是全局范围? - Javascript: why “this” inside the private function refers to the global scope? “ this”是指在私有函数中调用时的窗口 - “this” refers to window when called inside a private function Javascript-如果条件循环指向数组,则在其中跳过循环代码 - Javascript - If loop skipping code inside, if the condition refers to an array javascript:如何构建一个引用测验应用程序中变量的函数? - javascript: How to build a function that refers to the variables in my Quiz app? 当lambda函数引用封闭循环中的变量时,javascript范围问题 - javascript scope problem when lambda function refers to a variable in enclosing loop JavaScript:超类中的“this”指的是子类 - JavaScript: 'this' in superclass refers to subclass 当函数本身没有在全局上定义时,为什么这个内部函数指的是节点中的全局对象? - why this inside function refers to global object in node when function itself is not defined on global? 函数内部函数javascript - function inside function javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM