JS 中的‘this’是什么?

译者:江吉仪 原文地址: blog.brew.com.hk/what-is-thi… this是 JavaScript 最棘手的概念之一,简而言之, this 指向执行上下文。 全局上下文 当不在任何函数或者类(实际上只是函数)内是,this指向是全局执行上下文,当在浏览器时是 window 。 this; // window this.foo = "bar"; ...