scrimba
Frontend Career Path
Working with APIs
Intro to APIs
Section Recap
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
Section Recap
Expand for more info
index.js
run
preview
console
function getActivityIdea() {
fetch("https://apis.scrimba.com/bored/api/activity")
.then(res => res.json())
.then(data => {
document.getElementById("idea").textContent = data.activity
document.body.classList.add("fun")
document.getElementById("title").textContent = "🦾 HappyBot🦿"
})
}

document.getElementById("bored-button").addEventListener("click", getActivityIdea)
Console
/index.html
-1:29