Skip to content

London | 26-ITP-Jan | Mohsen Zamani | Sprint 1 | Destructuring#378

Open
mohsenzamanist wants to merge 5 commits intoCodeYourFuture:mainfrom
mohsenzamanist:feature/destructuring
Open

London | 26-ITP-Jan | Mohsen Zamani | Sprint 1 | Destructuring#378
mohsenzamanist wants to merge 5 commits intoCodeYourFuture:mainfrom
mohsenzamanist:feature/destructuring

Conversation

@mohsenzamanist
Copy link

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

Complete Sprint 1 Destructuring.

Questions

@mohsenzamanist mohsenzamanist added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 10, 2026
// Update the parameter to this function to make it work.
// Don't change anything else.
function introduceYourself(___________________________) {
function introduceYourself({ name, age, favouriteFood }) {

Choose a reason for hiding this comment

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

This is okay. Whenever you create a function that receives parameters, there is a possibility one of the params is not provided. Try to do some research and see how to prevent your program from crashing when it happens.

Copy link
Author

Choose a reason for hiding this comment

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

Nice read. Thank you.

@JaypeeLan JaypeeLan 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. labels Feb 12, 2026
@mohsenzamanist mohsenzamanist added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Feb 12, 2026
// Don't change anything else.
function introduceYourself(___________________________) {
function introduceYourself({
name = "NO_NAME_PROVIDED",

Choose a reason for hiding this comment

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

you've added default values to the function to protect against the function being used without parameters.
thats great!

}

introduceYourself(personOne);
introduceYourself();

Choose a reason for hiding this comment

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

according to the assignment, you aren't allowed to change any lines besides the function.
the change you made causes the function with no parameters, which only outputs the default values you added

);
};

// GryffindorHouse(hogwarts);

Choose a reason for hiding this comment

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

why is this commented out?

occupation === "Teacher" && pet && console.log(`${firstName} ${lastName}`)
);
};

Choose a reason for hiding this comment

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

see what the console output is when you run both of these methods GryffindorHouse and teacherHasPet after each other.
You may want to look at formatting the output better so that when these 2 methods are run its easy to see what the answer is for question 1 and question 2 of this exercise

},
];

const GryffindorHouse = (hogwarts) => {

Choose a reason for hiding this comment

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

please check the style guide regarding method naming so that your code is consistent and easily readable

@kyle-tightest kyle-tightest 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. labels Mar 12, 2026
@mohsenzamanist mohsenzamanist added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Mar 14, 2026
let total = 0;
order.forEach(({ itemName, quantity, unitPricePence }) => {
console.log(
`${quantity}${" ".repeat(7)}${itemName}${" ".repeat(20 - itemName.length)}${String(unitPricePence / 100).padEnd(4, 0)}`

Choose a reason for hiding this comment

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

nice work on the output formatting here

@kyle-tightest kyle-tightest added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 16, 2026
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