-
Notifications
You must be signed in to change notification settings - Fork 327
Conversation
wilgert
left a comment
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.
You did very well. Don't let my negative comment discourage you. I say those to help you grow!
Week1/homework/app.js
Outdated
| const ul = document.createElement('ul'); | ||
|
|
||
| // Use "for in" loop with objects | ||
| for (const book in myBooks) { |
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.
The instructions asked you to loop over the book titles in the myBookTitles array. And use each title to access the correct data from the myBooks object.
This is because the order of keys in an object is not guaranteed, while the order of items in an array is guaranteed. See: https://stackoverflow.com/questions/5525795/does-javascript-guarantee-object-property-order
So in the way that you build it the page could show the books in a different order on different computers.
Please change the booksInfo function so it loops over the myBookTitles array.
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.
Thank you for your feedback. I'm working on it
Week1/homework/app.js
Outdated
| }; | ||
|
|
||
| function bookCovers() { | ||
| for (const book in myBooks) { |
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.
This function looks really good. Great job!
| @@ -1 +1,52 @@ | |||
| /* add your styling here */ No newline at end of file | |||
| /* add your styling here */ | |||
| * { | |||
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.
Nice design! And good job for making it responsive!
Week1/homework/app.js
Outdated
| for (let i = 0; i < bookTitles.length; i++) { | ||
| const createHeading = document.createElement('h3'); | ||
| document.getElementById(bookTitles[i]).appendChild(createHeading); | ||
| const bookInfo = Object.keys(myBooks); |
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.
This bookInfo constant is not needed. You can do bookTitles[i] to get the object that holds the info of the book, just like you did on the line above.
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.
Thanks for your helpful feedback.
I have modified the code, and updated some links to improve the quality of the cover images.
- Please ignore the debugging sample files.
For review