Skip to content

London | 26-ITP-Jan | Boualem Larbi Djebbour | Sprint 2 | Book Library#482

Closed
djebsoft wants to merge 1 commit intoCodeYourFuture:mainfrom
djebsoft:main
Closed

London | 26-ITP-Jan | Boualem Larbi Djebbour | Sprint 2 | Book Library#482
djebsoft wants to merge 1 commit intoCodeYourFuture:mainfrom
djebsoft:main

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

fixed the bugs

Questions

@djebsoft djebsoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 24, 2026
@Luro91 Luro91 added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Apr 24, 2026
Copy link
Copy Markdown

@Luro91 Luro91 left a comment

Choose a reason for hiding this comment

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

Good job on fixing the Major bugs.
There are still some improvements that can be done

According to https://validator.w3.org/, there are errors in your index.html. Can you fix these errors?

}
changeBut.innerText = readStatus;

changeBut.innerText = myLibrary[i].check ? "Yes" : "No";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice use of the ternary operator

Comment on lines 30 to 45
if (
title.value == null ||
title.value == "" ||
author.value == null ||
author.value == "" ||
pages.value == null ||
pages.value == ""
) {
alert("Please fill all fields!");
return false;
} else {
let book = new Book(title.value, title.value, pages.value, check.checked);
library.push(book);
let book = new Book(title.value, author.value, pages.value, check.checked);
myLibrary.push(book);
render();
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Before using input in an app, we should properly preprocess it (even if basic validation has already been enforced in HTML):

  • Input Validation - Check whether the input meets expected formats, types, and constraints
  • Input Sanitization - Clean input to exclude unwanted or potentially harmful data
  • Input Normalization/Conversion - Transform input into the correct data type or a standardized, usable format

Questions to consider:

  • Should title and author be allowed to contain only space characters?
  • Should title and author be allowed to contain leading or trailing space characters?
  • What type of value should we use to store the page count?
  • What kinds of input values (if any) should be rejected?

Comment on lines +58 to 60
for (let n = rowsNumber - 1; n > 0; n--) {
table.deleteRow(n);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Efficient approach to remove rows in <table>

In render(), instead of deleting table rows one by one, we could delete all rows in one operation by clearing their container.


//add delete button to every row and render again
let delButton = document.createElement("button");
let delBut = document.createElement("button");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • Are the values assigned to the id attributes of the delete button unique?
  • Is there any need to assign an id attribute to the buttons?

@@ -54,7 +55,7 @@ function render() {
let table = document.getElementById("display");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When setting the text content of an HTML element, there are subtle but important differences between using .innerHTML, innerText, and textContent.

In render(), are the text values assigned to the appropriate property of each DOM node?

Comment on lines 94 to 95
alert(`You've deleted title: ${myLibrary[i].title}`);
myLibrary.splice(i, 1);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In the callback function of the delete button, 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.

@Luro91 Luro91 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. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Apr 24, 2026
@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

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants