Let's make a randomized dog photo gallery!
Write a function that makes an API call to https://dog.ceo/api/breeds/image/random. It should trigger after clicking a button in your webpage. Every time the button is clicked it should append a new dog image to the DOM.
- Create an
index.htmlfile that will display your random image - Add 2
<button>and 1<ul>element, either in the HTML or through JavaScript - When the button is clicked it should make an API call to
https://dog.ceo/api/breeds/image/random - After receiving the data, append to the
<ul>a<li>that contains an<img>element with the dog image - Incorporate error handling
Who knew programmers could be funny?
Write an function that makes an API call to https://xkcd.now.sh/?comic=latest
- Create a
HTML,CSSandJavaScriptfile to write your code in
- Inside the same file write a program that gets the
jsonusing Fetch. - A function should make an API call to the given endpoint:
https://xkcd.now.sh/?comic=latest - Log the received data to the console
- Render the
imgproperty into an<img>tag in the DOM - Incorporate error handling