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>