Skip to content

Conversation

@AhmadHmedann
Copy link

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

I fix all bugs

Questions

none

@AhmadHmedann AhmadHmedann added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 16, 2025
Copy link
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.

Can you check if any of this general feedback can help you further improve your code?
https://github.com/cjyuan/Module-Data-Flows/blob/book-library-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 Dec 16, 2025
@AhmadHmedann AhmadHmedann 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 Dec 17, 2025
@AhmadHmedann AhmadHmedann changed the title NW | 25-ITP-Sep | Ahmad Hmedan | sprint 2 | book library NW | 25-ITP-Sep | Ahmad Hmedan | Sprint 2 | Book Library Dec 17, 2025
Copy link
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.

Good start.

const titleValue = titleInput.value.trim();
const authorValue = authorInput.value.trim();
const pagesValue = Number(pagesInput.value);
if (!titleValue || !authorValue || !pagesValue || pagesValue < 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Some invalid "number of pages" could still pass this check.

Comment on lines 78 to 87
let readStatus = "";
if (myLibrary[i].check == false) {
if (myLibrary[i].check === true) {
readStatus = "Yes";
} else {
readStatus = "No";
}
changeBut.innerText = readStatus;
changeReadBut.textContent = readStatus;
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be a good opportunity to practice using the ? : conditional operator. Can you rewrite the code on lines 81–87 as a single statement?

for (let i = 0; i < length; i++) {
let row = table.insertRow(1);
let titleCell = row.insertCell(0);
let row = tableBody.insertRow(); // why (1) not i+1 insert <tr> with four <td>
Copy link
Contributor

Choose a reason for hiding this comment

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

It is best practice to declare a variable using const when the variable is not going to be reassigned a value. There are several variables that has this characteristic.

deleteBut.className = "btn btn-warning";
deleteBut.textContent = "Delete";
deleteBut.addEventListener("click", function () {
const DeletedTitle = myLibrary[i].title;
Copy link
Contributor

Choose a reason for hiding this comment

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

The convention is to start a variable name with a lowercase letter in JS. Names that begin with an uppercase letter are for data type or class (e.g., Array, String, Book).

@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 Dec 18, 2025
@AhmadHmedann AhmadHmedann 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 Dec 18, 2025
@AhmadHmedann
Copy link
Author

Thanks for the feedback, it is clear and helpful.

const titleValue = titleInput.value.trim();
const authorValue = authorInput.value.trim();
const pagesValue = Number(pagesInput.value);
if (!titleValue || !authorValue || Number.isFinite(!pagesValue) || pagesValue <= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

  • "Number of pages" probably cannot be this kind of values but this check cannot yet reject these type of numbers.

Comment on lines 78 to 89
let readStatus = "";
if (myLibrary[i].check == false) {
if (myLibrary[i].check === true) {
readStatus = "Yes";
} else {
readStatus = "No";
}
changeBut.innerText = readStatus;
readStatus= myLibrary[i].check===true? "yes":"no";

changeReadBut.textContent = readStatus;
Copy link
Contributor

Choose a reason for hiding this comment

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

Some of the code here is redundant.

Copy link
Contributor

Choose a reason for hiding this comment

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

There are still some variables that are assigned once declared using let.

@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 Dec 18, 2025
@AhmadHmedann AhmadHmedann 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 Dec 18, 2025
Copy link
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.

Changes look good.

@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 Dec 18, 2025
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants