setInterval()
每隔多少毫秒贬芥,執(zhí)行一次(循環(huán))
var timer = setInterval(function(){
},1000)
setInterval([方法],[時間])
clearInterval()
取消循環(huán)
clearInterval(timer)
setTimeout()
延遲多少毫秒,執(zhí)行一次(只執(zhí)行一次)
clearTimeout()
定時器內(nèi)部的this
都指向window