Skip to content

Conversation

@anosidium
Copy link

@anosidium anosidium commented Oct 28, 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

I completed all the exercises

Questions

@anosidium anosidium added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 28, 2025
@github-actions
Copy link

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).

2 similar comments
@github-actions
Copy link

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).

@github-actions
Copy link

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).

@anosidium anosidium force-pushed the coursework/sprint-3-practice-tdd branch from 4574d83 to 4002e46 Compare October 28, 2025 01:18
@jaymes15 jaymes15 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 1, 2025
@jaymes15 jaymes15 self-requested a review November 1, 2025 18:24
@@ -1,5 +1,7 @@
function countChar(stringOfCharacters, findCharacter) {
Copy link

Choose a reason for hiding this comment

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

@anosidium ✅ Great job! Your countChar function correctly counts occurrences and passes all test scenarios.
Using reduce here is neat and expressive. For clarity or performance, you could also consider a for...of loop, but your current solution is clean and idiomatic.

Copy link

Choose a reason for hiding this comment

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

@anosidium How should we handle cases where the first argument (stringOfCharacters) is an integer and the second (findCharacter) is a string — essentially when the parameters are of the wrong data types?

I believe adding a check for this would make the function more robust. What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

I agree and updated the countChar() function.

const char = "z";
const count = countChar(str, char);
expect(count).toEqual(0);
});
Copy link

Choose a reason for hiding this comment

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

@anosidium I think we can add more test cases to cover additional scenarios — such as how the function behaves with an empty string, a single occurrence, or when the character case differs (e.g., 'A' vs 'a').

It’s good practice to include these kinds of edge cases when writing tests to ensure the function handles all possible inputs robustly.

Copy link
Author

Choose a reason for hiding this comment

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

Agreed, I've added more test cases.

@@ -1,5 +1,15 @@
function repeat() {
return "hellohellohello";
function repeat(string, count) {
Copy link

Choose a reason for hiding this comment

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

It could also help to add a short comment above the function describing what it does and the expected parameter types — this improves readability for anyone new to the code.

@jaymes15 jaymes15 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 1, 2025
@anosidium anosidium 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 3, 2025
@mjpeet
Copy link

mjpeet commented Nov 5, 2025

good job getting those suggestions done!

@mjpeet mjpeet 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 5, 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.

3 participants