Birmingham | 25-ITP-Sept | Joy Opachavalit | Sprint 2 | Feature/Book Library#336
Birmingham | 25-ITP-Sept | Joy Opachavalit | Sprint 2 | Feature/Book Library#336enjoy15 wants to merge 3 commits intoCodeYourFuture:mainfrom
Conversation
cjyuan
left a comment
There was a problem hiding this comment.
Can you check if any of this general feedback can help you further improve your code?
https://github.com/cjyuan/Module-Data-Flows/blob/book-library-feedback/debugging/book-library/feedback.md
Update index.html and script.js as per feedbacks. |
| myLibrary.forEach((book, index) => { | ||
| const row = table.insertRow(); | ||
| row.innerHTML = ` | ||
| <td>${book.title}</td> | ||
| <td>${book.author}</td> | ||
| <td>${book.pages}</td> | ||
| <td><button class="btn btn-success toggle-read" data-index="${index}">${book.check ? "Yes" : "No"}</button></td> | ||
| <td><button class="btn btn-warning delete-book" data-index="${index}">Delete</button></td> | ||
| `; | ||
| }); |
There was a problem hiding this comment.
If title and author contain special characters such as '<' and '&' they could messed up the HTML output.
| const index = e.target.dataset.index; | ||
| myLibrary.splice(index, 1); | ||
| render(); | ||
| alert("Book deleted successfully."); |
There was a problem hiding this comment.
Currently when the alert dialog box appears, the UI is still showing the deleted item. The UI is only updated after the user closes the dialog box.
Can you figure out how to make the alert dialog box appear only after the UI is updated?
Notes:
- This change is optional.
- In practice, it might not be a good idea to use
alert()to show any message.
|
Good work! |
Learners, PR Template
Self checklist
Changelist