# 写一个 mySetInterVal(fn, a, b),每次间隔 a, a+b, a+2b,... a+nb 的时间,然后写一个 myClear, 停止上面的 mySetInterVal

function mySetInterVal(fn, a, b) {
  this.a = a; // 不变的值
  this.b = b; // 不变的值
  this.time = -1; // 变的值
  this.timer = -1;
  this.start = () => {
    this.timer = setTimeout(() => {
      fn();
      this.time++;
      this.start();
      console.log(this.a + this.time * this.b);
    }, this.a + this.time * this.b);
  };
  this.stop = () => {
    clearTimeout(this.timer);
    this.time = 0;
  };
}
var a = new mySetInterVal(
  () => {
    console.log(12222);
  },
  1000,
  2000
); /// 构造函数
a.start();
setTimeout(function() {
  a.stop();
}, 100000);