-
-
Notifications
You must be signed in to change notification settings - Fork 125
CYF London | Anna Fedyna | Module-Data-Flow | week 2 | book library fixed #103
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
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.
- There are few bugs (I marked them with "Todo" in the comments).
- Some of the files and code are not used. It will make reviewing code easier if you can keep them in a separate folder or remove them from the branch.
Thank you for the review, appreciate it! Fixed bugs and removed unused code. |
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.
Still have a bug.
Also, I added some more challenges for you.
title.value.trim() === "" || | ||
pages.value.trim() === "" || | ||
isNaN(pages.value) || | ||
parseInt(pages.value) <= 0 || | ||
!Number.isInteger(pages.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.
Still missed checking some value.
Some of these checks are redundant for ensuring pages.value
represents a positive integer.
pages.value.trim() === "" ||
isNaN(pages.value) ||
parseInt(pages.value) <= 0 ||
!Number.isInteger(pages.value)
let book = new Book( | ||
title.value, | ||
author.value, | ||
pages.value, | ||
check.checked | ||
); |
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.
Using input values directly without first sanitise them is dangerous.
What if the user enters " foo" as title, or "000000007" as pages?
And if you have time for more challenges, what if the user enters
" haha" or "Hello ©" as title?
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.