Lab 4 Entrance Assignment


What would be the output for a page containing the three initially empty paragraphs below and the three loops defining the contents of those paragraphs? (You can put the output at the bottom of the page, or to the right of each of the three loops.)

<p id="par1"></p>
<p id="par2"></p>
<p id="par3"></p>

<script>
var par1 = document.getElementById("par1");
var par2 = document.getElementById("par2");
var par3 = document.getElementById("par3");

for ( var x = 0; x < 10; x += 2 )
{
    par1.innerHTML += x + "<br>";
}    




for ( var x = 0; x < 5; x++ )
{
    for ( var y = 0; y < 2; y++ )
    {
        par2.innerHTML += "(" + x + ", " + y + ") ";
    }
    par2.innerHTML += "<br>";
}





for ( var x = 5; x > 0; x -= 2 )
{
    for ( var y = 0; y < x; y++ )
    {
        par3.innerHTML += "(" + x + ", " + y + ") <br>";
    }
}
</script>