JavaScript 循环语句

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>for与while循环</title>
</head>
<body>
    <script>
//for 循环
        for (var a = 1; a <= 5; a++) {
            document.write(a, "<br/>")
        }
 
 
//while 循环
        var n = 1;
        while (n <= 5) {
            document.write(n, "<br/>")
            n++;
        }
    </script>
</body>
posted @ 2019-03-27 20:12  木易#  阅读(149)  评论(1编辑  收藏  举报