-
-
Notifications
You must be signed in to change notification settings - Fork 260
Glasgow | 25-ITP-Sep | Hanna Mykytiuk | Sprint 3 | practice-tdd #814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,3 +34,8 @@ test("should return '12th' for 12", () => { | |
| test("should return '13th' for 13", () => { | ||
| expect(getOrdinalNumber(13)).toEqual("13th"); | ||
| }); | ||
| test("append 'nd' to numbers ending in 2, except those ending in 12", () => { | ||
| expect( getOrdinalNumber(2) ).toEqual("2nd"); | ||
| expect( getOrdinalNumber(22) ).toEqual("22nd"); | ||
| expect( getOrdinalNumber(132) ).toEqual("132nd"); | ||
| }); | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,16 @@ | ||
| function repeat(str, count) { | ||
|
|
||
| if (count < 0){ | ||
| return null | ||
| throw new Error("Count must be positive number!"); | ||
| } | ||
| else if (count == 0){ | ||
| return "" | ||
| return ""; | ||
| } | ||
| let result = ""; | ||
| for ( let i=0; i<count; i++){ | ||
| result +=str | ||
| result +=str; | ||
| } | ||
| return result | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = repeat; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could consider naming them
lastDigitandlastTwoDigits(more human readable).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I have changed it.