[JS 基础] 闭包 Closure-目前的一些使用场景举例

31 阅读1分钟
  1. 缓存 this; let self = this;

  2. apply 模拟 bind

Function.prototype._bind = function(caller){
      return function(args) {
        return caller.apply(caller, args)
      }
 }