Skip to content
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

West Midlands | Danial Bashirzadeh | Module-Data-Flows | sprint1 | Destructuring #133

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bashirzadehdanial
Copy link

@bashirzadehdanial bashirzadehdanial commented Jan 9, 2025

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.

@bashirzadehdanial bashirzadehdanial added the Needs Review Participant to add when requesting review label Jan 9, 2025
Copy link
Member

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, good job!


const itemTotal = quantity * unitPricePence;
total += itemTotal;
console.log(`${quantity.toString().padEnd(8)}${itemName.padEnd(20)}${(itemTotal/100).toFixed(2)}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you changed one of these numbers (e.g. made itemName pad to 25 instead of 20), you'd have to change another line of code a well.

Can you think how you can make it so that if you changed one of these numbers, you wouldn't need t ochange anything else?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Daniel for the valuable feedback. You are right, I can use a constant or variable to define the padding values, instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're currently only using the values 8 and 20 in one place, so I don't think a constant or variable would help here? That would only help if you were writing down 8 and 20 in multiple places...

@illicitonion illicitonion added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Jan 17, 2025
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants