In Javascript, why is the “this” operator inconsistent?

后端 未结 8 1772
挽巷
挽巷 2020-11-22 15:04

In JavaScript, the \"this\" operator can refer to different things under different scenarios.

Typically in a method within a JavaScript \"object\", it refers to the

8条回答
  •  遥遥无期
    2020-11-22 15:56

    If you're using Prototype you can use bind() and bindAsEventListener() to get around that problem.

提交回复
热议问题