Skip to content

Conversation

annafedyna
Copy link

@annafedyna annafedyna commented Dec 29, 2024

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@annafedyna annafedyna added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 29, 2024
@cjyuan cjyuan added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Dec 29, 2024
Copy link
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.

  1. There are few bugs (I marked them with "Todo" in the comments).
  2. 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.

@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. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Dec 29, 2024
@annafedyna
Copy link
Author

  1. There are few bugs (I marked them with "Todo" in the comments).
  2. 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.

Copy link
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.

Still have a bug.

Also, I added some more challenges for you.

Comment on lines +29 to +33
title.value.trim() === "" ||
pages.value.trim() === "" ||
isNaN(pages.value) ||
parseInt(pages.value) <= 0 ||
!Number.isInteger(pages.value)
Copy link
Contributor

@cjyuan cjyuan Dec 30, 2024

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)

Comment on lines +37 to +42
let book = new Book(
title.value,
author.value,
pages.value,
check.checked
);
Copy link
Contributor

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 &copy" as title?

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.

4 participants