Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
谁能像这样向我解释 JavaScript 代码的目的:
this._handleBlah = this._handleBlah.bind(this);
它出现在构造函数中,并且这种模式似乎在我正在阅读的代码库中使用。
当“成员”函数将用作事件处理程序或其他类似的回调情况时,它很有用。绑定的版本将具有正确的this值。
this