Published
Edited
Oct 2, 2021
1 fork
3 stars
Insert cell
Insert cell
mydeck = {
const deck = await fetch("https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1").then((response)=>{
return response.json()
}).then((response)=>{
return response
})
yield deck
}
Insert cell
{
const out = html``;
yield out;
const cardsobj = await fetch(`https://deckofcardsapi.com/api/deck/${mydeck.deck_id}/draw/?count=2`).then((response)=>response.json())
console.log(cardsobj)
cardsobj.cards.forEach((itm,idx,arr)=>{
out.appendChild(html`<div><img src="${itm.image}" title="${itm.value} of ${itm.suit}"/></div>`)
})
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more