JS Nested Loop

 
<!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>