scrimba
Frontend Career Path
Working with APIs
Async JS
Promises - .then()
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
Promises - .then()
Expand for more info
index.js
run
preview
console
// function handleClick() {
// fetch("https://apis.scrimba.com/deckofcards/api/deck/new/shuffle/")
// .then(res => res.json())
// .then(data => console.log(data))
// }

// document.getElementById("new-deck").addEventListener("click", handleClick)

fetch("https://apis.scrimba.com/deckofcards/api/deck/new/shuffle/")
.then(res => res.json())
.then(data => console.log(data))
Console
{success:
true
, deck_id:
"tzplw9cbstiv"
, remaining:
52
, shuffled:
true
}
,
/index.html
-2:11