diff --git a/fetch/programmer-humour/index.html b/fetch/programmer-humour/index.html new file mode 100644 index 00000000..542fe803 --- /dev/null +++ b/fetch/programmer-humour/index.html @@ -0,0 +1,13 @@ + + + + + + Programmer Humour + + + + + + + diff --git a/fetch/programmer-humour/script.js b/fetch/programmer-humour/script.js new file mode 100644 index 00000000..daeeb73b --- /dev/null +++ b/fetch/programmer-humour/script.js @@ -0,0 +1,14 @@ +function getComic() { + fetch("https://xkcd.vercel.app/?comic=latest") + .then((response) => response.json()) + .then((data) => { + console.log(data); + + const img = document.getElementById("comic"); + img.src = data.img; + }) + .catch((error) => { + console.log("Error:", error); + }); +} +getComic(); diff --git a/fetch/programmer-humour/style.css b/fetch/programmer-humour/style.css new file mode 100644 index 00000000..3fa9251a --- /dev/null +++ b/fetch/programmer-humour/style.css @@ -0,0 +1,7 @@ +body { + height: 100vh; + display: flex; + justify-content: center; + align-items: center; + background-color: rgb(58, 57, 55); +}