Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const BUTTON = document.querySelector('#button-1');
- BUTTON.addEventListener('click', handleClick);
- function handleClick(event) {
- console.dir(event);
- fetch('https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1')
- .then(takeCareOfResponseAndExtractJSON)
- .then(showCardOnPage)
- }
- function takeCareOfResponseAndExtractJSON(response) {
- return response.json();
- }
- function showCardOnPage(theJSONpartOfTheResponse) {
- console.dir(theJSONpartOfTheResponse);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement