Skip to content

Glasgow | 26-ITP-Jan| Martin McLean |Sprint 2|Book Library#448

Open
mjm-git185 wants to merge 5 commits intoCodeYourFuture:mainfrom
mjm-git185:leBibliateca
Open

Glasgow | 26-ITP-Jan| Martin McLean |Sprint 2|Book Library#448
mjm-git185 wants to merge 5 commits intoCodeYourFuture:mainfrom
mjm-git185:leBibliateca

Conversation

@mjm-git185
Copy link
Copy Markdown

Changelist

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
my coursework

@github-actions

This comment has been minimized.

@mjm-git185 mjm-git185 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 16, 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 16, 2026
@mjm-git185 mjm-git185 changed the title Glasgow | 26-ITP-Jan| Martin McLean |Sprint 2| libreiy Glasgow | 26-ITP-Jan| Martin McLean |Sprint 2|Book Library Apr 16, 2026
@mjm-git185 mjm-git185 added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Apr 16, 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.

Can you 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 Apr 16, 2026
@mjm-git185 mjm-git185 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 17, 2026
Comment thread debugging/book-library/index.html
Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/script.js Outdated
Comment on lines +79 to +82
myLibrary[i].check == true
? (readStatus = "Yes")
: (readStatus = "No");

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.

Normally way to use ? : is:

readStatus = myLibrary[i].check ? "Yes" : "No";

  • condition ? v1 : v2 is an expression. It evaluates to v1 if condition is true, and to v2 if condition is false.
  • .check is a boolean value. Comparing it to true is optional.

Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/script.js Outdated
@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 17, 2026
@mjm-git185 mjm-git185 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 17, 2026
Comment on lines +54 to +55
placeholder="Between 1 and 16000"
max="16000"
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.

Good idea. Why not also set the minimum?

Comment on lines +26 to +27
const titleInput = document.getElementById("title").value.trimStart();
const authorInput = document.getElementById("author").value.trimStart();
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.

What about trailing space?

} else {
let book = new Book(title.value, title.value, pages.value, check.checked);
library.push(book);
let book = new Book(titleInput, authorInput, pagesInput, checkInput);
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.

At this point, value of pageInput can be a string in the form "3e2". Why not convert the input to a value of type number at line 28 first?

button.addEventListener("click", function () {
myLibrary.splice(i, 1);
render();
alert(`You've deleted title: ${myLibrary[i].title}`);
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 you check if the alert correctly shows the title of the deleted book?

table.deleteRow(n);
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.

Clearing <tbody> is probably easier and more efficient.

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

2 participants