JavaScript-setTimeout

时间:2022-02-02 04:58:39
 <!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
//定时器中的回调函数必须等到主程序执行完才能开始执行
// for(var i=0;i<3;i++){setTimeout("console.log(i)",0);}
function fun(){var a=b=3;}
setTimeout("console.log(b)",0);
fun();
</script>
</body>
</html>