封装一个函数,此函数会有定时返回的操作

function abc (a, b, c) {
  var count = 0
  var timer = setInterval(function () {
    count++
    console.log(a, count)
    if (count === b) {
      clearInterval(timer)
    }
  }, c)
}

abc('abc123', 10, 1000)
原文地址:https://www.cnblogs.com/alone2015/p/5362223.html