-
-
Notifications
You must be signed in to change notification settings - Fork 458
week 8 home work done #1009
base: manchester3
Are you sure you want to change the base?
week 8 home work done #1009
Conversation
.then(function (data) { | ||
return data.json(); | ||
}) | ||
.then(function (newLink) { |
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.
Great variable name newLink
- always good to see 😄
return response.text(); | ||
}) | ||
.then(function (greeting) { |
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 variable name. All seems to be working fine to me
return data.json(); | ||
}) | ||
.then(function (newLink) { | ||
makeImage.src = newLink.message; |
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.
Ensure that any image you append onto the document also has an alt
attribute too
makeImage.src = newLink.message; | ||
}) | ||
.catch((error) => { | ||
console.log(error); |
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.
Maybe here you could also think about displaying an error message in case something goes wrong
@@ -0,0 +1,16 @@ | |||
fetch("https://xkcd.now.sh/?comic=latest") | |||
.then(function (data) { | |||
if (data.ok) { |
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.
Interesting that it has this ok
property - I've never seen that before
}) | ||
.then(function (newData) { | ||
const newImage = document.getElementById("image"); | ||
newImage.src = newData.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.
Again don't forget the alt
attribute here, Iman
<!-- Write your answer here --> | ||
<!-- | ||
{owner} = octocat | ||
{repo} = Hello-World |
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.
Looks good
|
||
2. Describe in a sentence what this API endpoint returns when all of the fields are completed? | ||
|
||
<!-- Write your answer here --> | ||
<!-- Provides details for a review comment. I havn't catch that much --> |
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.
Yeah exactly - looks to me like a pull request
Your Details
Your Name: Iman
Your City: Manchester
Your Slack Name: Iman-feisali
Homework Details
Module: JavaScript
Week: 8