Skip to content

London|25-ITP-September|Alexandru Pocovnicu|Sprint 1|Feature/destructuring#338

Closed
alexandru-pocovnicu wants to merge 7 commits intoCodeYourFuture:mainfrom
alexandru-pocovnicu:feature/destructuring
Closed

London|25-ITP-September|Alexandru Pocovnicu|Sprint 1|Feature/destructuring#338
alexandru-pocovnicu wants to merge 7 commits intoCodeYourFuture:mainfrom
alexandru-pocovnicu:feature/destructuring

Conversation

@alexandru-pocovnicu
Copy link
Copy Markdown

@alexandru-pocovnicu alexandru-pocovnicu commented Nov 30, 2025

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Used array and object destructuring to get values, calculated and displayed a receipt

@github-actions
Copy link
Copy Markdown

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

4 similar comments
@github-actions
Copy link
Copy Markdown

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

@github-actions
Copy link
Copy Markdown

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

@github-actions
Copy link
Copy Markdown

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

@github-actions
Copy link
Copy Markdown

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

@alexandru-pocovnicu alexandru-pocovnicu added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 30, 2025
@jennetturkkan jennetturkkan added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Dec 11, 2025
Copy link
Copy Markdown

@jennetturkkan jennetturkkan left a comment

Choose a reason for hiding this comment

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

Hi @alexandru-pocovnicu! Good work here. I left couple of comments that are suggestions but please fix variable declarations, where you use let, you should use const unless you expect the value to change

// Update the parameter to this function to make it work.
// Don't change anything else.
function introduceYourself(___________________________) {
function introduceYourself({name,age,favouriteFood }) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's correct but I think you Prettier is not working properly, the formatting is a bit off.

});

hogwarts.map(({ occupation, pet, firstName, lastName }) => {
if (occupation === "Teacher" && pet !== null) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could do it simpler by doing if (occupation === "Teacher" && pet) { because we know it's set to null when there is no pet. However, if pet could be empty string, number, undefined, false then if (pet) might give a wrong result.

You don't need to change anything, this is just an improvement you can keep in mind.

Comment on lines +11 to +15
let totalPence = quantity * unitPricePence;
let pence = totalPence % 100;
let paddedPence = String(pence).padStart(2, "0");
let pounds = Math.floor(totalPence / 100);
let priceEachItem = `${pounds}.${paddedPence}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why use let everywhere?

);
});
let sumAllPence = 0;
order.forEach(({ quantity, unitPricePence }) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: you could write this with reduce and it would be much cleaner, this is a perfect use case for reduce.

@jennetturkkan jennetturkkan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Dec 11, 2025
@alexandru-pocovnicu alexandru-pocovnicu closed this by deleting the head repository Jan 1, 2026
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.

2 participants