You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adjustments made on the repeat-str.js and repeat-str.test.js files to implement the repeatStr function and add test cases for it. The repeatStr function now uses the built-in repeat method to repeat the input string a specified number of times. The test cases cover various scenarios, including normal repetition, handling of zero count, and handling of negative count.
Copy file name to clipboardExpand all lines: Sprint-3/2-practice-tdd/get-ordinal-number.js
+25Lines changed: 25 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,3 +3,28 @@ function getOrdinalNumber(num) {
3
3
}
4
4
5
5
module.exports=getOrdinalNumber;
6
+
// Below is the implementation of the getOrdinalNumber function that converts a number to its ordinal form (e.g., 1 to "1st", 2 to "2nd", etc.).
7
+
// The function takes a single parameter `num`, which is the number to convert.
8
+
// It checks the last digit of the number to determine the appropriate suffix ("st", "nd", "rd", or "th") and returns the number concatenated with its ordinal suffix as a string.
Copy file name to clipboardExpand all lines: Sprint-3/2-practice-tdd/repeat-str.js
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,3 +3,11 @@ function repeatStr() {
3
3
}
4
4
5
5
module.exports=repeatStr;
6
+
// Below is the implementation of the repeatStr function that takes a string and a number as parameters and returns the string repeated the specified number of times.
7
+
// The function uses the built-in `repeat` method of strings to achieve this. It takes the input string and repeats it `n` times, where `n` is the number provided as the second parameter.
0 commit comments