Skip to content

London | ITP-Jan-26 | Abdul Moiz | Sprint 3 | Practice TDD#917

Open
A-Moiz wants to merge 2 commits intoCodeYourFuture:mainfrom
A-Moiz:coursework/sprint-3-practice-tdd
Open

London | ITP-Jan-26 | Abdul Moiz | Sprint 3 | Practice TDD#917
A-Moiz wants to merge 2 commits intoCodeYourFuture:mainfrom
A-Moiz:coursework/sprint-3-practice-tdd

Conversation

@A-Moiz
Copy link

@A-Moiz A-Moiz commented Jan 28, 2026

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 all exercises in Practice TDD directory

Questions

N/A

@A-Moiz A-Moiz added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jan 28, 2026
Comment on lines 3 to 4
let lastDigit = stringNum[stringNum.length - 1];
if (lastDigit === "1" && num % 100 !== 11) {
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Why not also store the last two digits in a variable first?
  • Why use different data type to represent the last digit and the last two digits?
  • For variables not need to be reassigned a value, it is a better practice to declare them using const.

Copy link
Author

Choose a reason for hiding this comment

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

Resolved function by storing last 2 digit.

Comment on lines +41 to +43
test("should append 'th' for all other numbers", () => {
expect(getOrdinalNumber(4)).toEqual("4th");
expect(getOrdinalNumber(11)).toEqual("11th");
Copy link
Contributor

@cjyuan cjyuan Feb 12, 2026

Choose a reason for hiding this comment

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

Could consider testing more samples in this category to make the test more comprehensive.

} else {
throw new Error("Count must be a non-negative integer");
}
return "";
Copy link
Contributor

Choose a reason for hiding this comment

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

The code on line 9 is unreachable (we call them "dead code").

Could consider not using else because of the return statements inside the if-blocks.

@cjyuan cjyuan 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. labels Feb 12, 2026
@A-Moiz A-Moiz 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 Feb 14, 2026
@cjyuan
Copy link
Contributor

cjyuan commented Feb 14, 2026

Changes look good. Well done.

@cjyuan cjyuan 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 Feb 14, 2026
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.

2 participants