SHARE
TWEET

Untitled

a guest Oct 21st, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fetch(url ='https://db.ygoprodeck.com/api/v5/randomcard.php')
  2. .then(response => response.json())
  3.  
  4. .then( json => {
  5.  
  6.     let div = document.querySelector('#random')
  7.     json.forEach(card => {
  8.         let ul = document.createElement('li')
  9.         let li = document.createTextNode(card.name)
  10.         let txt = document.createTextNode(card.type)
  11.         div.appendChild(ul)
  12.         ul.appendChild(li)
  13.         li.appendChild(txt)
  14.         console.log(card)
  15.                       })
  16.             })
  17.  
  18.  
  19.  
  20. const sleep = (milliseconds) => {
  21.     return new Promise(resolve => setTimeout(resolve, milliseconds))
  22.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top