While Loop tutorial in JavaScript

 <!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>While Loop JavaScript</title>
    <script>
        var a = 1;
        document.write("<ul>");
        while (a <= 10) {
            document.write("<li>" + a + ") Hello World</li>");
            a = a + 1;
        }
        document.write("</ul>");

        var b = 10;
        document.write("<ul>");
        while (b >= 1) {
            document.write("<li>" + b + ") Hello World</li>");
            b = b - 1;
        }
        document.write("</ul>");
    </script>
</head>

<body>
</body>

</html>





Comments

Popular posts from this blog

Generators tutorial in Advance JavaScript

Document Object Module DOM querySelector and querySelectorAll tutorial in JavaScript

Find Even and Odd Numbers with Loops tutorial in JavaScript