Just when I think I finally understand Javascript scope

前端 未结 4 692
傲寒
傲寒 2021-01-01 02:21

I run in to something that illustrates how I clearly don\'t get it yet.

Can anyone please explain why the value of \"this\" changes in the following?



        
4条回答
  •  伪装坚强ぢ
    2021-01-01 03:21

    At first glance I'd say it's because the outer 'this' is in reference to MyFunc and the inner 'this' is in reference to innerFunc.

    However, Javascript isn't something I have any particular expertise in.

提交回复
热议问题