Session Plan

Really try in this session to do short teaching and lots of exercises!

Flipped classroom videos

Flipped classroom videos

Code inspiration

DOM

Event listener

Fetch

Exercises

Favourite dishes

Create an array of strings with your favourite dishes.

With js select a ul in the DOM. You add the ul to the html file.

Now loop through each element of the favourite dishes array, you create an li element and set the text to the favourite dish.

Then append the li element to the ul element.

Podcast

  1. Create a ul

  2. Loop through the podcasts

  3. For every podcast:

    1. Create an li

    2. Create an h1 element

    3. Change the innerHTML of the h1 to equal the name of the current podcast

    4. Append the h1 to the li

    5. Now add an image to the li with the src set to the imageUrl. But only if the imageUrl key exists on the object!

  4. Append the li to the ul

Image inserter

Create a function that has two parameters: imageUrl and elementToAppendImageTo. The function should create an img tag and set the src attribute of the img to the imageUrl parameter. The function should then append the img to the elementToAppendImageTo - html element.

Simple event listener

When clicking a button, change the text on the button to say "Button clicked"

Light mode dark mode

Clicking a button should toggle the background color of the body and the text color in the page. If the background is white and the text is black, then clicking the button will make the background dark and the text white and vice versa

Optional also make the text on the button change.

Astronauts in space

Use this api to fetch how many astronauts are currently in spaces.

Add the following text to the DOM, using the data about astronauts:

An example with 2 astronauts could be:

Dog fan website

Let's create a site for dog lovers using this API: https://dog.ceo/api/breeds/image/random

  1. Get a random dog image and display it in the browser

  2. Get a new image every 2 sec.

  3. Get the list of all breeds from https://dog.ceo/api/breeds/list/all

  4. Display a random image of a breed from the list https://dog.ceo/api/breed/[BREEDNAME]/images/random

  5. Display the name of the breed under the image

Last updated