Skip to content

Conversation

@HoussamLh
Copy link

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

## Changelist

- Exercise 1:

  • Answered the question in the Readme file.
  • Updated the parameter to this function to make it work.
  • Used object destructuring in introduceYourself parameter.

- Exercise 2:

  • Writed a function named displayGryffindors that takes an object with multiple properties.
  • Displayed the names of the people who belong to the Gryffindor house.

- Exercise 3:

  • Created a function to print the order details
  • Used destructuring to access to multiple properties.
  • Calculated total price for each item.
  • Calculated total cost of the order.
  • Matched the exact formatting of the expected result.

## Questions

  1. Is my use of object destructuring in the functions clear and efficient, or could it be simplified?
  2. Are my variable names descriptive enough for readability and understanding?
  3. Did I follow best practices in calculating totals and formatting the order output in Exercise 3?
  4. Are there any edge cases I might have missed for the functions I wrote?

- Use object destructuring in introduceYourself parameter
…h properties `firstName`, `lastName`, `house`, `pet`, and `occupation` and display the names of the people who belong to the Gryffindor house.
… access itemName, quantity, and unitPricePence.
@HoussamLh HoussamLh added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 13, 2025
@LonMcGregor LonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Aug 18, 2025
Copy link

@LonMcGregor LonMcGregor left a comment

Choose a reason for hiding this comment

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

Good work on this task - I think you could improve your solution in task 2. Thanks for your questions:

  1. Is my use of object destructuring in the functions clear and efficient, or could it be simplified?

Yes, it's perfect

  1. Are my variable names descriptive enough for readability and understanding?

You've used good variable names

  1. Did I follow best practices in calculating totals and formatting the order output in Exercise 3?
    Yes, you've used appropriate higher level functions like forEach and reduce. Just be careful of the indentation which is a bit off on lines 40-42

  2. Are there any edge cases I might have missed for the functions I wrote?
    See my comment in exercise 2


function displayGryffindors({ firstName, lastName, house, pet, occupation }) {
if (house !== "Gryffindor") return;
console.log(`Hello, my name is ${firstName} ${lastName}. I am a ${occupation} at Hogwarts and I belong to the ${house} house. My pet is a ${pet ? pet : 'none'}.`);

Choose a reason for hiding this comment

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

It is good you have considered that they may not have a pet. However, the output is not very grammatically correct. Can you think of any way to improve that?

(You have some good example output in the readme - see if you can get that working)

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the feedback 🙏 You’re right — the sentence didn’t sound natural when there was no pet. I’ve updated the code so that it only mentions the pet if one exists. Now the output matches the example style.

@LonMcGregor LonMcGregor 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 Aug 18, 2025
Improve Gryffindor display function for better grammar  
- Updated pet handling so that the sentence is grammatically correct.  
- Now only mentions a pet if one exists.  
- Matches the example style.
@LonMcGregor
Copy link

Good solution to making the pet sentence optional. You are now done with this sprint

@LonMcGregor LonMcGregor added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants