简体   繁体   中英

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?

Inside the boo function, this will reference the boo function object, or "window" if you will. This is similar to the stacking of scopes in python, if you're familiar with that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM