-
Notifications
You must be signed in to change notification settings - Fork 327
JS2/Week1/Shvan #326
JS2/Week1/Shvan #326
Conversation
| //console.log(bookIds); | ||
|
|
||
| //3. | ||
| function books(bookIds) { |
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.
It's better to give a function a more 'active' name, that includes a verb. This is because a function is a tool you're using to get a certain job done. In this case, you could call it "displayBookList" or "renderBookTitles".
NoerGitKat
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.
Overall, nice job doing the exercises. I can see you're still trying to understand what the purpose of all of these elements are but you are getting there!
| window.addEventListener('load', books); | ||
|
|
||
| //4. | ||
| const DifferentBooks = { |
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 name of this variable can be more meaningful, like "bookDetails".
| //8. | ||
| function covers() { | ||
| const div = document.getElementById('items'); | ||
| const div2 = document.createElement('h1'); |
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.
Same advice here: naming variables and functions to be meaningful is very important. This is because you'll be reading your code over and over again, so a meaningful name helps you much quicker understand what's happening.
| divTag.className = 'my-books'; | ||
| const ul = document.createElement('ul'); | ||
| ul.className = 'books'; | ||
| bookIds.forEach(function(index) { |
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.
For consistency you could've used a for-loop again. It might look different, but both constructs (a for-loop and forEach) essentially do the same.
No description provided.