Skip to content

London | 26-ITP-May | Boualem Larbi Djebbour | Sprint 2 | Book Library #498

Open
djebsoft wants to merge 13 commits into
CodeYourFuture:mainfrom
djebsoft:book-library
Open

London | 26-ITP-May | Boualem Larbi Djebbour | Sprint 2 | Book Library #498
djebsoft wants to merge 13 commits into
CodeYourFuture:mainfrom
djebsoft:book-library

Conversation

@djebsoft
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

This PR previously discussed in #482
changes since last PR:
-responded to the reviewer comments and fixed bugs

@github-actions

This comment has been minimized.

@djebsoft djebsoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label May 18, 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 May 18, 2026
@djebsoft djebsoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label May 18, 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 May 18, 2026
@djebsoft djebsoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label May 18, 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 May 18, 2026
@djebsoft djebsoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label May 18, 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.

There are still some improvements you can make.

Can you first check if any of this general feedback can help you further improve your code?
https://github.com/CodeYourFuture/Module-Data-Flows/blob/general-review-feedback/debugging/book-library/feedback.md

Doing so can help me speed up the review process. Thanks.

@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 May 18, 2026
@djebsoft djebsoft added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels May 19, 2026
Comment thread debugging/book-library/script.js Outdated
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?

Comment thread debugging/book-library/script.js Outdated
Comment on lines +23 to +26
const titleInput = document.getElementById("title");
const authorInput = document.getElementById("author");
const pagesInput = document.getElementById("pages");
const checkInput = 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.

Could consider moving these declaration to the top. Common practice is to declare all shared (global) variables/constants at the begging of the file, before function definition.

Comment thread debugging/book-library/script.js Outdated
function populateStorage() {
if (myLibrary.length == 0) {
let book1 = new Book("Robison Crusoe", "Daniel Defoe", "252", true);
let book1 = new Book("Robinson 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.

Better practice is to consistently represent the data using the same data type. Here, page count is a string, and on line 50, page count is a value of type number.

Comment thread debugging/book-library/script.js Outdated
for (let n = rowsNumber - 1; n > 0; n-- {
table.deleteRow(n);
}
let tbody = table.tBodies[0];
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.

After ensuring the code is working correctly, a good practice during the refactoring phase is to change let to const for variables that will not be reassigned. Some of the variables fit this characteristic.

Comment thread debugging/book-library/script.js Outdated
Comment on lines 99 to 101
alert(`You've deleted title: ${myLibrary[i].title}`);
myLibrary.splice(i, 1);
render();
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 alert message is shown before the book is actually deleted; the deletion only occurs after the alert dialog is dismissed. This introduces a risk that the operation may not complete (e.g., if the user closes the browser before dismissing the alert).

In general, it’s better to display a confirmation message only after the associated operation has successfully completed.

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

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants