Sheffield | 26-Jan-ITP | Karim M'hamdi| Sprint 2 | Book library#459
Sheffield | 26-Jan-ITP | Karim M'hamdi| Sprint 2 | Book library#459KKtech06 wants to merge 4 commits intoCodeYourFuture:mainfrom
Conversation
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.
|
Hey CJ, I went through the general feedback link you shared and used the W3C validator to find and fix the errors in my HTML. I also went through my script.js and sorted out a few small things like the variable names and some unnecessary code. Thank you :) |
| true | ||
| ); | ||
| const book1 = new Book("Robison Crusoe", "Daniel Defoe", 252, true); | ||
| const book2 = new Book( "The Old Man and the Sea", "Ernest Hemingway",127,true); |
There was a problem hiding this comment.
Spacing not consistent. Have you enabled "Format on save" and selected "Prettier" as your default JS Formatter on your VSCode?
There was a problem hiding this comment.
Hey CJ, I turned on Prettier in VSCode so it now automatically fixes the spacing every time I save the file
| const book = new Book( | ||
| titleInput.value, | ||
| authorInput.value, | ||
| Number(pagesInput.value), | ||
| checkInput.checked | ||
| ); |
There was a problem hiding this comment.
- The code checks the trimmed value but it uses the untrimmed values.
- Repeatedly convert string to number can affect performance.
A better and safer approach to deal with user input is to first store the preprocessed input in variables,
then use those cleaned values consistently throughout the rest of the code.
|
Changes look good. |
|
Closing PR because the January ITP run has finished. Feel free to re-open if you're still working on it. |
Learners, PR Template
Self checklist
Changelist: I used the general feedback link to improve the code - fixed HTML errors using the W3C validator and cleaned up script.js by fixing variable names and removing unnecessary code.
Questions: N/A