Skip to content

London | 26-May-ITP | Yonatan Teklemariam | Sprint 2 | exercises#1237

Open
Yonatanteklemariam wants to merge 8 commits into
CodeYourFuture:mainfrom
Yonatanteklemariam:Sprint-2
Open

London | 26-May-ITP | Yonatan Teklemariam | Sprint 2 | exercises#1237
Yonatanteklemariam wants to merge 8 commits into
CodeYourFuture:mainfrom
Yonatanteklemariam:Sprint-2

Conversation

@Yonatanteklemariam

@Yonatanteklemariam Yonatanteklemariam commented Jul 8, 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

debugged all the three functions and fixed them.
implemented the contains() and wrote the tests for it, re-run all of them. all tests checked/passed.

@Yonatanteklemariam Yonatanteklemariam added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 8, 2026
@Yonatanteklemariam Yonatanteklemariam changed the title London | 26-May-ITP | Yonatan Teklemariam | Sprint 2 | debug London | 26-May-ITP | Yonatan Teklemariam | Sprint 2 | exercises Jul 8, 2026
@Yonatanteklemariam Yonatanteklemariam removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 8, 2026
@Yonatanteklemariam Yonatanteklemariam added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 17, 2026
@Yonatanteklemariam

Yonatanteklemariam commented Jul 17, 2026

Copy link
Copy Markdown
Author

Hi @LonMcGregor, how are you? I hope you're well. Could you please go through my exercises and give me your feedback? Thanks

@LonMcGregor LonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Jul 22, 2026

@LonMcGregor LonMcGregor 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.

Good start, I have a few comments

// When passed to tally
// Then it should return an empty object
test("tally on an empty array returns an empty object", () => {
expect([]).toEqual({});

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 get a failure when I run this test, can you find out why?

});
});

test("prints country and currency vertically", () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Typically the point of using tests is to test the output, if the output is correct, then we can trust that anything printed should be correct. This means we don't want a function under test to print anything. With that in mind, what is the purpose of this test?

if (typeof item !== "string" || !/^[A-Za-z0-9]+$/.test(item)) {
throw new Error("Please Enter Valid Input!");
}
counts[item] = (counts[item] ?? 0) + 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.

Can you explain how ?? works here?


// a) What is the current return value when invert is called with { a : 1 }
// take only the values
const values = entries.map(([_, v]) => v);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Instead of getting the entries, then mapping for the values, is there a faster route to getting the values?

@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 Jul 22, 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