API, Media Queries

Solution retrospective
A problem I found using API's for the first time is that you need to resolve the promise (JSON fetch)
Please log in to post a comment
Log in with GitHubCommunity feedback
- @fazzaamiarso
Hello Noah!
You can actually chain the
getAPI
function directly .function getAdvice(){ getAPI().then(function(data){ let adviceNumber = document.getElementById("adviceNumber"); let adviceText = document.getElementById("advice"); adviceNumber.innerHTML = "ADVICE # "+data.slip.id; adviceText.innerHTML = "\""+data.slip.advice+"\"" });
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord