diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 000000000..f673a71b7
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "liveServer.settings.port": 5502
+}
\ No newline at end of file
diff --git a/week-8/Homework/mandatory/2-fetch-exercise/exercise.js b/week-8/Homework/mandatory/2-fetch-exercise/exercise.js
index fb3a39c2a..4189eb7dd 100644
--- a/week-8/Homework/mandatory/2-fetch-exercise/exercise.js
+++ b/week-8/Homework/mandatory/2-fetch-exercise/exercise.js
@@ -17,10 +17,13 @@ Open index.html in your browser. Every time you refresh the page,
a different greeting should be displayed in the box.
*/
-fetch('*** Write the API address here ***')
- .then(function(response) {
+fetch('https://codeyourfuture.herokuapp.com/api/greetings')
+ .then(function (response) {
return response.text();
})
- .then(function(greeting) {
+ .then(function (greeting) {
+ let greetingText = document.getElementById("greeting-text")
+ greetingText.innerText = greeting
+
// Write the code to display the greeting text here
});
\ No newline at end of file
diff --git a/week-8/Homework/mandatory/3-dog-photo-gallery/gallery.html b/week-8/Homework/mandatory/3-dog-photo-gallery/gallery.html
new file mode 100644
index 000000000..0c4a743a3
--- /dev/null
+++ b/week-8/Homework/mandatory/3-dog-photo-gallery/gallery.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+ Document
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week-8/Homework/mandatory/3-dog-photo-gallery/script.js b/week-8/Homework/mandatory/3-dog-photo-gallery/script.js
new file mode 100644
index 000000000..a57e7777c
--- /dev/null
+++ b/week-8/Homework/mandatory/3-dog-photo-gallery/script.js
@@ -0,0 +1,22 @@
+let x = document.getElementById("gallery")
+let clickedButton = document.getElementById("button")
+let list = document.getElementById("list")
+function fetchData() {
+ fetch('https://dog.ceo/api/breeds/image/random')
+ .then(function (response) {
+ return response.json();
+ })
+ .then(function (data) {
+ console.log(data);
+ showImg(data)
+ })
+ .catch((error) => console.log(error));
+}
+clickedButton.addEventListener("click", fetchData)
+function showImg(data) {
+ let ul = document.createElement("li")
+ list.appendChild(ul)
+ let img1 = document.createElement("img")
+ ul.appendChild(img1)
+ img1.src = data.message
+}
\ No newline at end of file
diff --git a/week-8/Homework/mandatory/3-dog-photo-gallery/style.css b/week-8/Homework/mandatory/3-dog-photo-gallery/style.css
new file mode 100644
index 000000000..e69de29bb
diff --git a/week-8/Homework/mandatory/3-dog-photo-gallery/task.md b/week-8/Homework/mandatory/3-dog-photo-gallery/task.md
index af6b99a50..73cbf967c 100644
--- a/week-8/Homework/mandatory/3-dog-photo-gallery/task.md
+++ b/week-8/Homework/mandatory/3-dog-photo-gallery/task.md
@@ -9,3 +9,16 @@ Write a function that makes an API call to `https://dog.ceo/api/breeds/image/ran
- 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 `
` a `
` that contains an `` element with the dog image
- Incorporate error handling
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week-8/Homework/mandatory/4-programmer-humour/index.html b/week-8/Homework/mandatory/4-programmer-humour/index.html
new file mode 100644
index 000000000..911234f4b
--- /dev/null
+++ b/week-8/Homework/mandatory/4-programmer-humour/index.html
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+ Document
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week-8/Homework/mandatory/4-programmer-humour/javascript.js b/week-8/Homework/mandatory/4-programmer-humour/javascript.js
new file mode 100644
index 000000000..4f56dccee
--- /dev/null
+++ b/week-8/Homework/mandatory/4-programmer-humour/javascript.js
@@ -0,0 +1,19 @@
+let gallery = document.getElementById("gallery")
+fetchData()
+
+function fetchData() {
+ fetch('https://xkcd.now.sh/?comic=latest')
+ .then(function (response) {
+ return response.json();
+ })
+ .then(function (data) {
+ console.log(data);
+ showImg(data)
+ })
+ .catch((error) => console.log(error));
+}
+function showImg(data) {
+ let img1 = document.createElement("img")
+ gallery.appendChild(img1)
+ img1.src = data.img
+}
\ No newline at end of file