Skip to content

Commit 08cb4ea

Browse files
committed
Unused code removed
1 parent 218cead commit 08cb4ea

3 files changed

Lines changed: 2 additions & 62 deletions

File tree

Sprint-3/2-practice-tdd/get-ordinal-number.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,4 @@
11

2-
/*
3-
function getOrdinalNumber(num) {
4-
const s = num.toString();
5-
const lastDigit = num % 10;
6-
const lastTwoDigits = num % 100;
7-
8-
// Rule for 11th, 12th, 13th (The "Teens" exception)
9-
if (lastTwoDigits >= 11 && lastTwoDigits <= 13) {
10-
return s + "th";
11-
//return "1st";
12-
13-
// Standard rules based on the last digit
14-
switch (lastDigit) {
15-
case 1:
16-
return s + "st";
17-
case 2:
18-
return s + "nd";
19-
case 3:
20-
return s + "rd";
21-
default:
22-
return s + "th";
23-
}
24-
}
25-
}
26-
*/
27-
28-
292
function getOrdinalNumber(num) {
303
const s = num.toString();
314
const lastDigit = num % 10;

Sprint-3/2-practice-tdd/repeat-str.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ function repeatStr(str, count) {
33
throw new Error("Count must be a non-negative integer");
44
}
55

6-
// If count is 0, .repeat(0) naturally returns an empty string "".
7-
// If count is 1, .repeat(1) naturally returns the original string.
6+
87
return str.repeat(count);
9-
//return "hellohellohello";
8+
109
}
1110

1211
module.exports = repeatStr;

Sprint-3/2-practice-tdd/repeat-str.test.js

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,5 @@
11
// Implement a function repeatStr
22
const repeatStr = require("./repeat-str");
3-
// Given a target string `str` and a positive integer `count`,
4-
// When the repeatStr function is called with these inputs,
5-
// Then it should:
6-
7-
// Case: handle multiple repetitions:
8-
// Given a target string `str` and a positive integer `count` greater than 1,
9-
// When the repeatStr function is called with these inputs,
10-
// Then it should return a string that contains the original `str` repeated `count` times.
11-
12-
/*
13-
test("should repeat the string count times", () => {
14-
const str = "hello";
15-
const count = 3;
16-
const repeatedStr = repeatStr(str, count);
17-
expect(repeatedStr).toEqual("hellohellohello");
18-
});
19-
*/
20-
21-
// Case: handle count of 1:
22-
// Given a target string `str` and a `count` equal to 1,
23-
// When the repeatStr function is called with these inputs,
24-
// Then it should return the original `str` without repetition.
25-
26-
// Case: Handle count of 0:
27-
// Given a target string `str` and a `count` equal to 0,
28-
// When the repeatStr function is called with these inputs,
29-
// Then it should return an empty string.
30-
31-
// Case: Handle negative count:
32-
// Given a target string `str` and a negative integer `count`,
33-
// When the repeatStr function is called with these inputs,
34-
// Then it should throw an error, as negative counts are not valid.
353

364

375
describe("repeatStr", () => {

0 commit comments

Comments
 (0)