极速小乌龟

导航

JavaScript-setTimeout

 1 <!DOCTYPE html>
 2 <html>
 3 <head lang="en">
 4     <meta charset="UTF-8">
 5     <title></title>
 6 </head>
 7 <body>
 8 <script>
 9     //定时器中的回调函数必须等到主程序执行完才能开始执行
10 //    for(var i=0;i<3;i++){setTimeout("console.log(i)",0);}
11     function fun(){var a=b=3;}
12     setTimeout("console.log(b)",0);
13     fun();
14 </script>
15 </body>
16 </html>

 

posted on 2016-12-29 06:48  极速小乌龟  阅读(141)  评论(0编辑  收藏  举报