Explorer
project
index.css
index.html
index.js
Dependencies
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
fetch("https://apis.scrimba.com/unsplash/photos/random?orientation=landscape&query=nature")
.then(res => res.json())
.then(data => {
document.body.style.backgroundImage = `url(${data.urls.regular})`
document.getElementById("author").textContent = `By: ${data.user.name}`
})
.catch(err => {
// Use a default background image/author
document.body.style.backgroundImage = `url(https://images.unsplash.com/photo-1560008511-11c63416e52d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwyMTEwMjl8MHwxfHJhbmRvbXx8fHx8fHx8fDE2MjI4NDIxMTc&ixlib=rb-1.2.1&q=80&w=1080
)`
document.getElementById("author").textContent = `By: Dodi Achmad`
})
/**
* Challenge: Pull down the cryptocurrency data for dogecoin from the
* CoinGecko API and log it to the console
*
* Also add a .catch() method to console any errors that might occur to the console
*/
fetch("https://api.coingecko.com/api/v3/coins/dogecoin")
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err))