What is the use of the JavaScript 'bind' method?

后端 未结 19 1921
自闭症患者
自闭症患者 2020-11-21 06:24

What is the use of bind() in JavaScript?

19条回答
  •  伪装坚强ぢ
    2020-11-21 06:39

    As mentioned, Function.bind() lets you specify the context that the function will execute in (that is, it lets you pass in what object the this keyword will resolve to in the body of the function.

    A couple of analogous toolkit API methods that perform a similar service:

    jQuery.proxy()

    Dojo.hitch()

提交回复
热议问题