码迷,mamicode.com
首页 > Web开发 > 详细

JS定时器

时间:2020-02-01 00:43:53      阅读:76      评论:0      收藏:0      [点我收藏+]

标签:block   eval   end   on()   ber   enc   play   tor   定时器   

setTimeout/clearTimeout

let timerId = setTimeout(func|code, [delay], [arg1], [arg2], ...)
// 在一秒后执行func
setTimeout(function() {
 console.log(1)
}, 1000)
?
// 一秒后,将该字符串当作代码来执行(eval函数)
setTimeout(‘console.log(1)‘, 1000)
?
// func有参数时
setTimeout(function(a,b,c) {
 console.log(a, b, c)
}, 1000, 1, 2, 3)

setTimeout 与 clearTimeout:

JS定时器

标签:block   eval   end   on()   ber   enc   play   tor   定时器   

原文地址:https://www.cnblogs.com/rLydia/p/12247014.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!