CSD 360 - JS Array Loops

Mod 7 Assignment

This assignment displays two ordered lists consisting of 10 sports teams. The first is presented in the original order and the second in reverse order. The lists are generated dynamically using JavaScript. The JavaScript code first creates an array to hold the names of the 10 teams. Then using two separate for loops, the first to generate the list in the original order and the second to generate the list in reverse order. Both loops iterate through the teams array and uses innerHTML to append the HTML code with a list item for the ordered lists. The results are shown on the right.

Ordered Lists

Original Order

Reverse Order