-
-
Notifications
You must be signed in to change notification settings - Fork 458
Conversation
I think you were meant to write down some answers to exercise 1 as well :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job Shahd, only left minor comments! :)
@@ -17,10 +17,12 @@ 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 ***') | |||
fetch("https://codeyourfuture.herokuapp.com/api/greetings") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, works well!
const li = document.createElement("li"); | ||
const myImg = document.createElement("img"); | ||
|
||
function displayer(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well!
fetch("https://dog.ceo/api/breeds/image/random") | ||
.then(response => response.json()) | ||
.then(data => data.message) | ||
.then(function (img){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to stick to the same function format (e.g. arrow functions) for consistency.
ul.appendChild(li); | ||
myImg.src = img; | ||
}) | ||
.catch(err => console.error(err)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about error handling? Could you do something more than just console.log it?
div.appendChild(img); | ||
img.src = myData; | ||
}) | ||
.catch(anyErr => console.error(anyErr)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, think about error handling. What could you display to the user?
const div = document.getElementById("container"); | ||
const img = document.createElement("img"); | ||
|
||
function fether(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well!
Your Details
Your Name:
Your City:
Your Slack Name:
Homework Details
Module:
Week: