-
-
Notifications
You must be signed in to change notification settings - Fork 73
GLASGOW | DATA FLOWS | AIDA ZHUKOVA | BOOK LIBRARY #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://validator.w3.org/, there are errors in your index.html
. Can you fix these errors?
Code works, but there are some improvements you can still make.
debugging/book-library/script.js
Outdated
if ( | ||
title.value == null || | ||
title.value == "" || | ||
pages.value == null || | ||
pages.value == "" | ||
pages.value == null || | ||
pages.value == "" || | ||
author.value == null || | ||
author.value == "" | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (let n = rowsNumber - 1; n > 0; n--) { | ||
table.deleteRow(n); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of deleting the table rows one by one, can you think of a more efficient way to remove all rows (except the <th>...</th>
) in the table?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Lines 79, 97:
- Are the values assigned to these
id
attributes unique? - Is there any need to assign an id attribute to either buttons?
- Are the values assigned to these
-
Line 73:
- With the way the book's title is assigned to an HTML element, a book with a title containing special character sequence such as
<i>
can possibly ruin the display.
- With the way the book's title is assigned to an HTML element, a book with a title containing special character sequence such as
-
Can you think of a more consistent way to name the variables representing the two buttons,
changeBut
anddelButton
?
debugging/book-library/script.js
Outdated
@@ -53,8 +55,10 @@ function Book(title, author, pages, check) { | |||
function render() { | |||
let table = document.getElementById("display"); | |||
let rowsNumber = table.rows.length; | |||
console.log(myLibrary) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is for debugging/testing purpose, we should remove it from the "final product".
Thank you for review, @cjyuan . I've made some changes. Thanks |
In terms of input validation
All the other changes look good. |
I've made some changes. About invalid number - I added in HTML type- number and minimum value:1. Now it accepts only positive numbers. |
What if a user enters |
Thanks I changed it. |
Looks good. You could also set up the HTML element to accept only integer. Anyway, feel free to label this PR "Complete". |
Ok. Thank you. |
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.