Skip to content

Cape Town | 2026-ITP-Jan | Pretty Taruvinga | Sprint 2 | Book Library#473

Closed
Pretty548 wants to merge 5 commits intoCodeYourFuture:mainfrom
Pretty548:book-library-debbuging
Closed

Cape Town | 2026-ITP-Jan | Pretty Taruvinga | Sprint 2 | Book Library#473
Pretty548 wants to merge 5 commits intoCodeYourFuture:mainfrom
Pretty548:book-library-debbuging

Conversation

@Pretty548
Copy link
Copy Markdown

@Pretty548 Pretty548 commented Apr 22, 2026

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

  1. Fixed index.html
  2. Fixed script.js

Questions

None

@github-actions

This comment has been minimized.

4 similar comments
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@Pretty548 Pretty548 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 22, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 22, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@Pretty548 Pretty548 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 23, 2026
Copy link
Copy Markdown
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Code looks good. I will mark this as "Complete" first.

Comment thread debugging/book-library/script.js Outdated
@@ -1,46 +1,45 @@
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.

Can we declare myLibrary in a way that prevents it from being accidentally reassigned?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good point! I’ve updated myLibrary to use const to prevent reassignment.

Comment on lines +24 to +27
const titleInput = document.getElementById("title");
const authorInput = document.getElementById("author");
const pagesInput = document.getElementById("pages");
const readCheckbox = document.getElementById("check");
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.

Normal practice is to declare all shared variables/constants at the beginning of the file (before function definition).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for pointing that out , I’ll move these declarations to the top of the file for better organization.

Comment thread debugging/book-library/script.js Outdated
Comment on lines 53 to 58
const table = document.getElementById("display");

// remove old rows (keep header row)
while (table.rows.length > 1) {
table.deleteRow(1);
}
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.

Note: Easier and more efficient to just clear <tbody>.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion — I’ve updated the render function to clear and rebuild the instead.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Apr 23, 2026
Comment thread debugging/book-library/script.js Outdated
const authorCell = document.createElement("td");
const pagesCell = document.createElement("td");
const wasReadCell = document.createElement("td");
const deleteCell = document.createElement("td");
Copy link
Copy Markdown
Contributor

@cjyuan cjyuan Apr 23, 2026

Choose a reason for hiding this comment

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

Why not use the original approach? That is,

    let titleCell = row.insertCell(0);
    let authorCell = row.insertCell(1);
    let pagesCell = row.insertCell(2);
    let wasReadCell = row.insertCell(3);
    let deleteCell = row.insertCell(4);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks! I’ve applied this approach — I’m now using row.insertCell() for each column (title, author, pages, read status, delete), which simplifies the DOM manipulation and keeps the structure clear.

@illicitonion
Copy link
Copy Markdown
Member

Closing PR because the January ITP run has finished. Feel free to re-open if you're still working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. Module-Data-Flows The name of the module. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants