setInterval, this, again

前端 未结 5 1469
故里飘歌
故里飘歌 2021-01-27 16:32

I have a problem in regard to setInterval that I can\'t figure out.

There is the problem with the scope when calling setInterval or timeout fro

5条回答
  •  一向
    一向 (楼主)
    2021-01-27 17:07

    You put ships[i].bing in setTimeout turns out that the caller of bing is not ships[i] but global, so _this is pointing to global actually.

提交回复
热议问题