Skip to content

London | 26-ITP-May | Edina Kurdi | Sprint 2 | Coursework - #1422

Open
edinakurdi wants to merge 15 commits into
CodeYourFuture:mainfrom
edinakurdi:coursework/sprint-2
Open

London | 26-ITP-May | Edina Kurdi | Sprint 2 | Coursework#1422
edinakurdi wants to merge 15 commits into
CodeYourFuture:mainfrom
edinakurdi:coursework/sprint-2

Conversation

@edinakurdi

@edinakurdi edinakurdi commented Aug 11, 2026

Copy link
Copy Markdown

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

Data Groups - Sprint 2

  • debug
    • Address
    • Author
    • Recipe
  • implement
    • contains + test
    • lookup + test
    • querystring + test
    • tally + test
  • interpret
    • invert + test

@github-actions

This comment has been minimized.

4 similar comments
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@edinakurdi edinakurdi added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Groups The name of the module. labels Aug 11, 2026
@Poonam-raj Poonam-raj 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 Aug 12, 2026
Comment thread Sprint-2/debug/author.js
Comment on lines +20 to +23
console.log(Object.values(author));
// for (const value of author) {
// console.log(value);
// }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A good workaround to print the values of the object.

Question - how could the for loop on lines 21 - 23 be changed (to a different loop for example) to achieve the same effect?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Created an alternative using a loop

Comment thread Sprint-2/debug/recipe.js
Comment on lines +17 to +22
const recipeValues = Object.values(recipe);
// ["bruschetta", 2, ["olive oil", "tomatoes", "salt", "pepper"]]

const ingredients = recipeValues.slice(-1)[0];
// ["olive oil","tomatoes","salt","pepper"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

good use of methods but how could we reduce the amount of code we're writing here?

Is there a more direct way to access the ingredients so you can join them on line 25?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

oh, i seem to have created more work for myself than needed. corrected now

Comment on lines +6 to +11
if (keysInObject.includes(propertyName)) {
return true;
} else {
return false;
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How could you refactor these lines to be more concise?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes, since it returns a boolean, I dont have to write if else statement. done.

Comment on lines +26 to +38
describe("when given valid inputs", () => {
test("should return an object where (Input ==> Output): keys:values ==> country code: corresponding currency", () => {
expect(
createLookup([
["US", "USD"],
["CA", "CAD"],
])
).toEqual({
US: "USD",
CA: "CAD",
});
});
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you have included a simpler test to start with for valid inputs?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

i added a simpler input with only one array in the array (one country's data)

test.todo("contains on empty object returns false");
describe("given an empty object", () => {
test("should return false when passed to contains", () => {
expect(contains({}, "a").toBe(false));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This line fails - please correct it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

oh those brackets... fixed now.

throw new Error("Invalid input. All elements should be arrays");
}

return Object.fromEntries(countryCurrencyPairs);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice choice of method

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

thank you i came across it when learning about iterating through objects. very handy.

Comment on lines +30 to +36
//each key-value pair will form an array in a bigger array (array of arrays of key-value pairs)

// d) Explain why the current return value is different from the target output
/* issues:
- .key notation naming the key "key"
- we only assign the key to value, but not reversing it
*/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice explanations here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

thanks

Comment on lines +28 to +30
expect(tally(["a"])).toEqual({ a: 1 });
expect(tally(["a", "a", "a"])).toEqual({ a: 3 });
expect(tally(["a", "a", "b", "c"])).toEqual({ a: 2, b: 1, c: 1 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I actually think these are three different behaviours and so deserve their own test blocks to anyone reading them test suite can see the different behaviours clearly.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

corrected.

@@ -1,3 +1,18 @@
function tally() {}
function tally(array) {
if (typeof array === "string") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What if the input is a number or a boolean? How can you change this condition so it will hold up against any wrong input type?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes, i took the instructions too literally :)
corrected and test written for this version

throw new Error("Input should be an array");
}

let tallySet = {};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Would this code still work if you made the variable a constant? Explain your answer :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes, and updated it.
It would work still, as the variable ramains the same, we are not trying to update it, merely working with the items inside

const keyValuePairs = queryString.split("&");

//filter out empty strings from the keyValuePairs array of strings
let filteredKeyValuePairs = keyValuePairs.filter(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

could this be a const?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes, and i changed it now. (as above) I need to rememer to use const instead of let

@Poonam-raj Poonam-raj left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Few comments, slight amendments/refactors or explanations needed - take a look, nice work here though, good use of methods and testing throughout

@Poonam-raj Poonam-raj 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 Aug 12, 2026
@edinakurdi edinakurdi 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 Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Data-Groups The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants