js 闭包

this.color = "blue";
(function(_this) {
  setInterval(function() {
    if (_this.color !== "red") {
      _this.color = "red";
    } else {
      _this.color = "blue";
    }

    console.log(_this)
  }, 1000)
})(this)
原文地址:https://www.cnblogs.com/happen-/p/6134619.html