js用for of 遍历数组

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        //我们可以用for of 遍历数组:
        var arr=[1,2,3,4,5];
        for(a of arr){
            console.log(a);
        }
    </script>
</body>
</html>

 

posted @ 2017-12-08 15:34  技术让世界更精彩  阅读(5280)  评论(0编辑  收藏  举报