Exercise: Using iteration and the DOM

Write a function that adds an ordered list of 10 items to the web page, where the first item is "This is item number 1.", the second item is "This is item number 2." and so on.

Note:

Hints:

  • Use window.onload.

Solution to the exercise

Here is a possible solution.

Note:

Hints:

  • undefined
1
2
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX