Skip to content

London | 26-ITP-May | Ebrahim Moqbel | sprint 3 | practice tdd - #1595

Open
Ebrahim-Moqbel wants to merge 3 commits into
CodeYourFuture:mainfrom
Ebrahim-Moqbel:coursework-sprint-3/practice-tdd
Open

London | 26-ITP-May | Ebrahim Moqbel | sprint 3 | practice tdd#1595
Ebrahim-Moqbel wants to merge 3 commits into
CodeYourFuture:mainfrom
Ebrahim-Moqbel:coursework-sprint-3/practice-tdd

Conversation

@Ebrahim-Moqbel

@Ebrahim-Moqbel Ebrahim-Moqbel commented Jul 31, 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

completed the TDD files and added some test cases for revision purposes

Questions

N/A

@github-actions

This comment has been minimized.

@Ebrahim-Moqbel Ebrahim-Moqbel added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Structuring-And-Testing-Data The name of the module. labels Jul 31, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 31, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@Ebrahim-Moqbel Ebrahim-Moqbel changed the title London | 26-ITP-May | Ebrahim Moqbel | Coursework sprint 3/practice tdd London | 26-ITP-May | Ebrahim Moqbel | sprint 3 \ practice tdd Aug 1, 2026
@Ebrahim-Moqbel Ebrahim-Moqbel changed the title London | 26-ITP-May | Ebrahim Moqbel | sprint 3 \ practice tdd London | 26-ITP-May | Ebrahim Moqbel | sprint 3 | practice tdd Aug 1, 2026
@Ebrahim-Moqbel Ebrahim-Moqbel added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 1, 2026
@cjyuan cjyuan 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 5, 2026
Comment on lines +1 to +12
//counts the number of times a character occurs in a string
function countChar(stringOfCharacters, findCharacter) {
return 5
let count =0;
for (let char of stringOfCharacters) {
if (char === findCharacter) {
count+=1;
}
}


return count

@cjyuan cjyuan Aug 5, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Code is correct.

  • The spacing around the operators is not quite consistent. Why not use a formatter to keep the code consistently formatted?

  • In a for-of or for-in loop, normally we don't need to reassign the loop variable a different value in the loop, so common practice is to declare the loop variable using const.

Comment on lines +6 to +9
test("should count the number of times a character occurs in a string", () => {
expect(countChar('hello world', "o")).toEqual(2);
expect(countChar('hello world', "l")).toEqual(3);
expect(countChar('hello world', "z")).toEqual(0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good to test multiple samples.

Comment on lines +7 to +19
// umbers ending with 1
if (lastDigit === 1) {
return num + "st";
}
// numbers ending with 2
if (lastDigit === 2) {
return num + 'nd';
}
// numbers ending with 3
if (lastDigit === 3) {
return num + 'rd';
}
//any other number

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the code is clear and readable already without the comments. You could consider removing them.

@cjyuan cjyuan 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 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Structuring-And-Testing-Data The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants