[removed] When and when not to use “this”

前端 未结 4 1898
野的像风
野的像风 2021-02-06 20:23

Im curious when it is needed/best practice to use the keyword this. I understand that this is used when determining a functions this value

4条回答
  •  孤城傲影
    2021-02-06 20:42

    For a starting JS developer it might be easiest to get concept of This by using it in an event listener callback. I. e., "click" event binds This to object which is the target (Like "look, i clicked on THIS!").

    • Item 1
    • Item 2
    • Item 3

    Of course Rajeshs answer is much, much more complex, but I hope THIS can be also helpful…

提交回复
热议问题