JS: this
this 這個特別的變數或說關鍵字,一樣也是在建立函式的執行環境(execution context)的時候就會一起建立,但因為箭頭函式(arrow function)沒有自己的this,所以只有一般函式(function declaration, function expression)會有this關鍵字。
在介紹不同環境的this究竟是指向誰之前,首先有幾個點要注意:
大致來說,this 指的是「有該函式的擁有者」,這一點等會在說明this指向就會一目瞭然;
this 不會指向函式本身,而...
urlun0404.hashnode.dev1 min read