Skip to content
This repository has been archived by the owner on Oct 26, 2020. It is now read-only.

Shahd week 8 #1003

Closed
Closed

Conversation

shahdalhaj
Copy link

Your Details

Your Name:
Your City:
Your Slack Name:

Homework Details

Module:
Week:

@msachi
Copy link
Member

msachi commented Jul 4, 2020

I think you were meant to write down some answers to exercise 1 as well :)

Copy link
Member

@msachi msachi left a 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")
Copy link
Member

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(){
Copy link
Member

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){
Copy link
Member

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));
Copy link
Member

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));
Copy link
Member

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(){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well!

@shahdalhaj shahdalhaj closed this Jul 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants