Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://github.com/Giphy/GiphyAPI
- const body = document.querySelector('body')
- fetch('http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&rating=pg')
- .then((res) => res.json())
- .then((data) => data.data)
- .then((image) => {
- let img = document.createElement('img')
- img.src = image.image_original_url
- img.style = 'display: block; margin: 0 auto; margin-top: 100px; border: 30px inset teal; border-radius: 10px;'
- body.appendChild(img)
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement