Skip to content

London | JAN-ITP-26 | Damian Dunkley | Sprint 2 | Book Library#427

Open
DamianDL wants to merge 8 commits intoCodeYourFuture:mainfrom
DamianDL:Debug
Open

London | JAN-ITP-26 | Damian Dunkley | Sprint 2 | Book Library#427
DamianDL wants to merge 8 commits intoCodeYourFuture:mainfrom
DamianDL:Debug

Conversation

@DamianDL
Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Bugs fixed

  1. Website loads and shows list of books
  2. Can add a book
  3. Correctly displays title and author name
  4. Delete button works
  5. Correctly stores read books

Code refactored in JS and HTML

Questions

Please review

@DamianDL DamianDL added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Flows The name of the module. labels Apr 14, 2026
@DamianDL DamianDL added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Apr 15, 2026
type="number"
class="form-control"
min="1"
maxlength="10000"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's a lot of digits!

@@ -1,44 +1,54 @@
let myLibrary = [];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Lines 85, 98:
    • Are the values assigned to these id attributes unique?
    • Is there any need to assign an id attribute to either buttons?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Data-Flows The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants