JS延迟执行

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script type="text/javascript">
        for(var i = 0 ; i < 10; i++){
            setTimeout((function(i){
              return function(){ console.log(i);}
            })(i), i*1000);
        }
    </script>
</head>
<body>

</body>
</html>

 

posted @ 2018-02-10 19:45  Liu66~  阅读(230)  评论(0编辑  收藏  举报