Skip to content

Conversation

@shaghayeghfar
Copy link

@shaghayeghfar shaghayeghfar commented Nov 5, 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

In this exercise we were asked to change some parts in our functions and test files, i changed the codes where ever i was asked and then test them to make sure all of the test passes.

@shaghayeghfar shaghayeghfar added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 5, 2025
@ckirby19 ckirby19 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 Nov 15, 2025
Copy link

@ckirby19 ckirby19 left a comment

Choose a reason for hiding this comment

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

Great work! Most of my comments are just extensions to test your knowledge :)

// console.log(value);
// }

for (const value of Object.values(author)) {

Choose a reason for hiding this comment

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

Just as an extension, what could you do instead if you wanted to console.log key:value together?

Copy link
Author

Choose a reason for hiding this comment

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

for (const [key, value] of Object.entries(author)) {
console.log(${key}: ${value});
}

Choose a reason for hiding this comment

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

Very good! Don't forget the brackets around the $ sign, console.log(${key}: ${value});


// ${recipe.serves} → 2

// ${recipe} → wrong! = > because recipe is an object, and when you interpolate it into a string, it becomes:

Choose a reason for hiding this comment

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

Just as an extension: in javascript every object will have a toString() method which is what is called here when we interpolate it as a string. This method can actually be modified directly so that you customise what happens when console.log is called on it. Could you show me how you would add this method to this object?

Copy link
Author

Choose a reason for hiding this comment

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

recipe.toString = function () {
return ${this.title} serves ${this.serves}. Ingredients: ${this.ingredients.join(", ")};
};

console.log(String(recipe));

Choose a reason for hiding this comment

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

Nice one, just missing the quotes as above

// Loop through each pair in the array
for (let i = 0; i < pairs.length; i++) {
const pair = pairs[i]; // e.g. ['US', 'USD']
const country = pair[0]; // first element is country code

Choose a reason for hiding this comment

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

As an extension: could you show me how you can use array destructuring to define country and currency in one line?

Copy link
Author

Choose a reason for hiding this comment

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

const [country , currency] = pair[i];


//invertedObj.key = value; → sets the literal property "key" instead of using the variable value as the

// e) Fix the implementation of invert (and write tests to prove it's fixed!)

Choose a reason for hiding this comment

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

Am I missing the tests and implementation fix somewhere? I don't see it

Copy link
Author

Choose a reason for hiding this comment

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

sorry I forgot to do this part, I sort it out and I push my changes . thanks again

Choose a reason for hiding this comment

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

Great, let me know when you add this and I will review it

Copy link
Author

@shaghayeghfar shaghayeghfar Nov 25, 2025

Choose a reason for hiding this comment

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

@ckirby19
Dear Conor ,
thank you for your time, I added the code and pushed it .
thanks again for all of your help and support.

@ckirby19 ckirby19 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 Nov 15, 2025
@shaghayeghfar shaghayeghfar 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 Nov 19, 2025
@super-lumic super-lumic 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 Nov 29, 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.

4 participants