JavaScript Nested Loop - II

 
<!DOCTYPE html>
<html>
<head>
  <title>JavaScript</title>
  <script>
    for (var a = 1; a <= 5; a++) {
        for (var b = 1; b <= a; b++) {
            document.write(b + " ");
        }
        document.write("<br>");
     }
  </script>
</head>
<body>
</body>
</html>
 
<!DOCTYPE html>
<html>
<head>
  <title>JavaScript</title>
  <script>
    for (var a = 1; a <= 5; a++) {
         for (var b = 1; b <= a; b++) {
             document.write(a + " ");
         }
         document.write("<br>");
        }
  </script>
</head>
<body>
</body>
</html>
 
<!DOCTYPE html>
<html>
<head>
  <title>JavaScript</title>
  <script>
    for (var a = 5; a >= 1; a--) {
            for (var b = 1; b <= a; b++) {
                document.write(a + " ");
            }
            document.write("<br>");
        }
  </script>
</head>
<body>
</body>
</html>
 
<!DOCTYPE html>
<html>
<head>
  <title>JavaScript</title>
  <script>
    for (var a = 5; a >= 1; a--) {
            for (var b = a; b >= 1; b--) {
                document.write(b + " ");
            }
            document.write("<br>");
        }
  </script>
</head>
<body>
</body>
</html>