x
 
1
<!DOCTYPE html>
2
<title>My Example</title>
3
4
5
<p id="msg"></p>
6
7
<script>
8
  // Set variables
9
  var output = "";
10
11
  // Outer loop
12
  for (i = 1; i <= 10; i++) {
13
14
      output += "<h1>" + i + " times table</h1>";
15
      output += "<ul>";
16
17
        // Inner loop
18
        for (j = 1; j <= 10; j++) {
19
          output += "<li>" + j + " x " + i + " = " + j * i;
20
      }
21
22
      output += "</ul>";
23
24
  }
25
26
  // Output results to the above HTML element
27
  document.getElementById("msg").innerHTML = output;
28
</script>