歸納總結this的指向問題

this:上下文,會根據執行環境變化而發生指向的改變. 1.單獨的this,指向的是window這個對象 alert(this); // this -> window 2.全局函數中的this function demo() { alert(this); // this -> window } demo(); 在嚴格模式下,this是undefined. function demo() {
相關文章
相關標籤/搜索