London | JAN-ITP-26 | Damian Dunkley | Sprint 2 | Book Library#427
Open
DamianDL wants to merge 8 commits intoCodeYourFuture:mainfrom
Open
London | JAN-ITP-26 | Damian Dunkley | Sprint 2 | Book Library#427DamianDL wants to merge 8 commits intoCodeYourFuture:mainfrom
DamianDL wants to merge 8 commits intoCodeYourFuture:mainfrom
Conversation
…rectly, read lables match checkbox update, delete button handels correctly
…ed load event parameter
cjyuan
reviewed
Apr 16, 2026
| type="number" | ||
| class="form-control" | ||
| min="1" | ||
| maxlength="10000" |
| @@ -1,44 +1,54 @@ | |||
| let myLibrary = []; | |||
Contributor
There was a problem hiding this comment.
Could consider using const.
| if (myLibrary.length == 0) { | ||
| let book1 = new Book("Robison Crusoe", "Daniel Defoe", "252", true); | ||
| let book2 = new Book( | ||
| const book1 = new Book("Robison Crusoe", "Daniel Defoe", "252", true); |
Contributor
There was a problem hiding this comment.
The page count here is specified as a string, whereas in submit() the page count assigned to a new book is a number. It is best practice to keep this consistent by using the same data type in both cases.
Comment on lines
+48
to
+49
| titleInput.value = title; | ||
| authorInput.value = author; |
Contributor
There was a problem hiding this comment.
Why update the input field with the trimmed values? Why not do the same for "pages")?
Comment on lines
79
to
81
| titleCell.innerHTML = myLibrary[i].title; | ||
| authorCell.innerHTML = myLibrary[i].author; | ||
| pagesCell.innerHTML = myLibrary[i].pages; |
Contributor
There was a problem hiding this comment.
Please note that when setting the text content of an HTML element, there are subtle but important differences between using .innerHTML, innerText, and textContent.
| delBut.addEventListener("clicks", function () { | ||
| alert(`You've deleted title: ${myLibrary[i].title}`); | ||
| const deleteBut = document.createElement("button"); | ||
| deleteBut.id = i + 5; |
Contributor
There was a problem hiding this comment.
- Lines 85, 98:
- Are the values assigned to these
idattributes unique? - Is there any need to assign an id attribute to either buttons?
- Are the values assigned to these
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
Bugs fixed
Code refactored in JS and HTML
Questions
Please review