Skip to content

Commit e448679

Browse files
committed
updates to sprint-2 in res[ponse to PR feedback from PR
1 parent 1f4a688 commit e448679

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
function getOrdinalNumber(num) {
22
// return "1st";
3-
``
3+
44
const lastTwoDigits = num % 100;
5-
if (lastTwoDigits >= 11 && lastTwoDigits<= 13)
6-
return num + "th";
7-
5+
if (lastTwoDigits >= 11 && lastTwoDigits <= 13) return num + "th";
6+
87
if (num % 10 === 1) {
98
return num + "st";
109
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ function repeatStr(str, count) {
22
if (count < 0) {
33
throw new Error("Count must be a non-negative integer");
44
}
5-
let result = "";
6-
for (let i = 0; i < count; i++) {
7-
result += str;
8-
}
9-
return result;
5+
//let result = "";
6+
//for (let i = 0; i < count; i++) {
7+
//result += str;
8+
9+
return str.repeat(count);
1010
}
1111

1212
module.exports = repeatStr;

0 commit comments

Comments
 (0)