是否有任何方法可以传递this到立即调用的函数表达式,而无需解析var that = this(在某些情况下不适用)?
试过以下但没有运气:
(function(that) {
console.log(that);
})(this)
Run Code Online (Sandbox Code Playgroud)
(function() {
console.log(this); // whatever that was specified in the "call" method
}).call(this);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
359 次 |
| 最近记录: |