scrimba
Note at 0:37
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

AboutCommentsNotes
Note at 0:37
Expand for more info
index.js
run
preview
console
const btn = document.getElementById("btn")
const foodDisplay = document.getElementById("foodHolder")

const findYum = async () => {
const response = await fetch('https://foodish-api.herokuapp.com/api/images/dessert')
const data = await response.json()
foodDisplay.innerHTML = `<img src='${data.image}' />`
}

btn.addEventListener("click", findYum)
/* Task:
Call the Foodish API (https://foodish-api.herokuapp.com/) and display random images of desserts on the click of a button.

Specific URL to get a random dessert image:
https://foodish-api.herokuapp.com/api/images/dessert

Stretch goals:
- Show multiple desserts.
- Add the functionality to go back to the previous image.
*/

Console
/index.html
LIVE