JavaScript/Adding elements/Exercises

Topic: Creating elements and attributes

We use a nearly empty HTML page for the exercises.

1. Modify the function.
 * It creates a paragraph &lt;p> with the content "One of my children".

2. Modify the function in a way that it adds a list to the HTML page.

3. Modify the function in a way that it adds a list to the HTML page. Implement it in a way that the list may vary in length and in its content over time.

To reach the goal of variable length, you must use a loop over the offered products. Save your product list in an array and loop over it.

4. Modify the function in a way that it adds a particular image to the HTML page.

Change the image's size by adding the attribute  with a value of "300px". Mark the image with a unique identifier, e.g., "newImage"

5. Extend the previous example. After the image is added to the page, the behavior changes. The second and all further clicks on the button reduce the image's size by 10% - without adding another button.