Glasgow | 26-ITP-Jan| Martin McLean |Sprint 2|Book Library#448
Glasgow | 26-ITP-Jan| Martin McLean |Sprint 2|Book Library#448mjm-git185 wants to merge 5 commits intoCodeYourFuture:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cjyuan
left a comment
There was a problem hiding this comment.
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.
| myLibrary[i].check == true | ||
| ? (readStatus = "Yes") | ||
| : (readStatus = "No"); | ||
|
|
There was a problem hiding this comment.
Normally way to use ? : is:
readStatus = myLibrary[i].check ? "Yes" : "No";
condition ? v1 : v2is an expression. It evaluates tov1ifconditionis true, and tov2if conditionis false..checkis a boolean value. Comparing it totrueis optional.
| placeholder="Between 1 and 16000" | ||
| max="16000" |
There was a problem hiding this comment.
Good idea. Why not also set the minimum?
| const titleInput = document.getElementById("title").value.trimStart(); | ||
| const authorInput = document.getElementById("author").value.trimStart(); |
| } else { | ||
| let book = new Book(title.value, title.value, pages.value, check.checked); | ||
| library.push(book); | ||
| let book = new Book(titleInput, authorInput, pagesInput, checkInput); |
There was a problem hiding this comment.
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}`); |
There was a problem hiding this comment.
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); | ||
| } |
There was a problem hiding this comment.
Clearing <tbody> is probably easier and more efficient.
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