小程序的回调函数中广泛用到了“var that = this”,ajax的success回调函数中也曾用到“var that =this”,那么var that=this到底有什么作用呢。

javascript语言中,this代表着当前的对象,即当前操作的dom元素的对象,它在程序中随着执行的上下文随时会变化,即随着操作不同的dom对应的数值会对应发生变化。

js中var that=this的重要性

 

参考:https://www.jianshu.com/p/1ab0b8c4c078

相关文章:

  • 2021-05-21
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
猜你喜欢
  • 2021-08-20
  • 2021-07-22
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
  • 2021-08-23
  • 2022-12-23
相关资源
相似解决方案