From c4261fd6cc2e157437074c1c5ff5953269072c25 Mon Sep 17 00:00:00 2001 From: russom Date: Sat, 4 Jul 2026 21:48:31 +0100 Subject: [PATCH 01/17] if condition created inside getAngleType function to evaluate the type of angle --- .../implement/1-get-angle-type.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js index 9e05a871e2..d5b3343dfe 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js @@ -16,6 +16,19 @@ function getAngleType(angle) { // TODO: Implement this function + if (angle > 0 && angle < 90) { + return "Acute angle"; + } else if (angle === 90) { + return "Right angle"; + } else if (angle > 90 && angle < 180) { + return "Obtuse angle"; + } else if (angle === 180) { + return "Straight angle"; + } else if (angle > 180 && angle < 360) { + return "Reflex angle"; + } else { + return "Invalid angle"; + } } // The line below allows us to load the getAngleType function into tests in other files. From 3331c94ff9f7b925e4464d1330dcb74114aca8be Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 7 Jul 2026 11:35:26 +0100 Subject: [PATCH 02/17] Test cases for Right and Obtuse angles created. --- .../1-get-angle-type.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js index d777f348d3..a34b99e4fc 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js @@ -14,7 +14,20 @@ test(`should return "Acute angle" when (0 < angle < 90)`, () => { }); // Case 2: Right angle +test(`should return "Right angle" when (angle === 90)`, () => { + // Test various acute angles, including boundary cases + expect(getAngleType(89)).toEqual("Right angle"); + expect(getAngleType(90)).toEqual("Right angle"); + expect(getAngleType(91)).toEqual("Right angle"); +}); + // Case 3: Obtuse angles +test(`should return "Obtuse angle" when (angle > 90 && angle < 180)`, () => { + // Test various acute angles, including boundary cases + expect(getAngleType(91)).toEqual("Obtuse angle"); + expect(getAngleType(145)).toEqual("Obtuse angle"); + expect(getAngleType(179)).toEqual("Obtuse angle"); +}); // Case 4: Straight angle // Case 5: Reflex angles // Case 6: Invalid angles From d16b7fbf4000cacb5db4349033dc0f2486d495cf Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 7 Jul 2026 11:52:16 +0100 Subject: [PATCH 03/17] Test cases for Straight, Reflex and Invalid angles created and tested. --- .../1-get-angle-type.test.js | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js index a34b99e4fc..98eaf63728 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js @@ -15,19 +15,36 @@ test(`should return "Acute angle" when (0 < angle < 90)`, () => { // Case 2: Right angle test(`should return "Right angle" when (angle === 90)`, () => { - // Test various acute angles, including boundary cases - expect(getAngleType(89)).toEqual("Right angle"); + // Test Right angles. expect(getAngleType(90)).toEqual("Right angle"); - expect(getAngleType(91)).toEqual("Right angle"); }); // Case 3: Obtuse angles test(`should return "Obtuse angle" when (angle > 90 && angle < 180)`, () => { - // Test various acute angles, including boundary cases + // Test various Obtuse angles, including boundary cases expect(getAngleType(91)).toEqual("Obtuse angle"); expect(getAngleType(145)).toEqual("Obtuse angle"); expect(getAngleType(179)).toEqual("Obtuse angle"); }); + // Case 4: Straight angle +test(`should return "Straight angle" when (angle === 180)`, () => { + // Test Obtuse angles. + expect(getAngleType(180)).toEqual("Straight angle"); +}); + // Case 5: Reflex angles +test(`should return "Reflex angle" when (angle > 180 && angle < 360)`, () => { + // Test various Reflex angles, including boundary cases + expect(getAngleType(181)).toEqual("Reflex angle"); + expect(getAngleType(240)).toEqual("Reflex angle"); + expect(getAngleType(359)).toEqual("Reflex angle"); +}); + // Case 6: Invalid angles +test(`should return "Invalid angle" when (angle < 0 && angle > 360)`, () => { + // Test various Invalid angles that are less that 0 or above 360 degrees. + expect(getAngleType(0)).toEqual("Invalid angle"); + expect(getAngleType(361)).toEqual("Invalid angle"); +}); + From c3617ce7a981e97b8c9dfc080210d7455694e6b4 Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 7 Jul 2026 12:10:49 +0100 Subject: [PATCH 04/17] More test cases added for invalid angles including negative numbers. --- .../rewrite-tests-with-jest/1-get-angle-type.test.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js index 98eaf63728..ca052f15aa 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js @@ -23,7 +23,7 @@ test(`should return "Right angle" when (angle === 90)`, () => { test(`should return "Obtuse angle" when (angle > 90 && angle < 180)`, () => { // Test various Obtuse angles, including boundary cases expect(getAngleType(91)).toEqual("Obtuse angle"); - expect(getAngleType(145)).toEqual("Obtuse angle"); + expect(getAngleType(135)).toEqual("Obtuse angle"); expect(getAngleType(179)).toEqual("Obtuse angle"); }); @@ -37,14 +37,15 @@ test(`should return "Straight angle" when (angle === 180)`, () => { test(`should return "Reflex angle" when (angle > 180 && angle < 360)`, () => { // Test various Reflex angles, including boundary cases expect(getAngleType(181)).toEqual("Reflex angle"); - expect(getAngleType(240)).toEqual("Reflex angle"); + expect(getAngleType(270)).toEqual("Reflex angle"); expect(getAngleType(359)).toEqual("Reflex angle"); }); // Case 6: Invalid angles test(`should return "Invalid angle" when (angle < 0 && angle > 360)`, () => { - // Test various Invalid angles that are less that 0 or above 360 degrees. + // Test various Invalid angles that are less that are negative number, 0 and numbers that are above 360 degrees. + expect(getAngleType(-9)).toEqual("Invalid angle"); expect(getAngleType(0)).toEqual("Invalid angle"); - expect(getAngleType(361)).toEqual("Invalid angle"); + expect(getAngleType(360)).toEqual("Invalid angle"); + expect(getAngleType(450)).toEqual("Invalid angle"); }); - From 29fc3b32fe0f39ed3ef273b18cc6ccf01d4bcef6 Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 7 Jul 2026 13:39:46 +0100 Subject: [PATCH 05/17] A return expression added into isProperFraction function --- .../implement/2-is-proper-fraction.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js index 970cb9b641..0985d513a8 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -12,6 +12,7 @@ function isProperFraction(numerator, denominator) { // TODO: Implement this function + return numerator > 0 && numerator < denominator; } // The line below allows us to load the isProperFraction function into tests in other files. From 94c1f50632d866ab5a48941fb15c606298a514e2 Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 14 Jul 2026 10:16:59 +0100 Subject: [PATCH 06/17] Test case for no occurrences scenario for a char in a str created. --- Sprint-3/2-practice-tdd/count.test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sprint-3/2-practice-tdd/count.test.js b/Sprint-3/2-practice-tdd/count.test.js index 179ea0ddf7..9f910f59ea 100644 --- a/Sprint-3/2-practice-tdd/count.test.js +++ b/Sprint-3/2-practice-tdd/count.test.js @@ -22,3 +22,10 @@ test("should count multiple occurrences of a character", () => { // And a character `char` that does not exist within `str`. // When the function is called with these inputs, // Then it should return 0, indicating that no occurrences of `char` were found. + +test("should return 0 when if no occurrences of a character", () => { + const str = "cc"; + const char = "b"; + const count = countChar(str, char); + expect(count).toEqual(0); +}); \ No newline at end of file From d4edc9da148f74ccad14cf0705163b3caa5fb968 Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 14 Jul 2026 10:18:12 +0100 Subject: [PATCH 07/17] Test case for handling 0 and negative counts of a char in a str created. --- Sprint-3/2-practice-tdd/repeat-str.test.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Sprint-3/2-practice-tdd/repeat-str.test.js b/Sprint-3/2-practice-tdd/repeat-str.test.js index a3fc1196c4..a575a69b87 100644 --- a/Sprint-3/2-practice-tdd/repeat-str.test.js +++ b/Sprint-3/2-practice-tdd/repeat-str.test.js @@ -21,12 +21,33 @@ test("should repeat the string count times", () => { // When the repeatStr function is called with these inputs, // Then it should return the original `str` without repetition. +test("should repeat the string count times", () => { + const str = "hi"; + const count = 1; + const repeatedStr = repeatStr(str, count); + expect(repeatedStr).toEqual("hi"); +}); + // Case: Handle count of 0: // Given a target string `str` and a `count` equal to 0, // When the repeatStr function is called with these inputs, // Then it should return an empty string. +test("should repeat the string count times", () => { + const str = ""; + const count = 0; + const repeatedStr = repeatStr(str, count); + expect(repeatedStr).toEqual(""); +}); + // Case: Handle negative count: // Given a target string `str` and a negative integer `count`, // When the repeatStr function is called with these inputs, // Then it should throw an error, as negative counts are not valid. + +test("should repeat the string count times", () => { + const str = "hello"; + const count = -1; + const repeatedStr = repeatStr(str, count); + expect(repeatedStr).toEqual(""); +}); From e82f88c33c48e13e84e433949c5aedbcb938a182 Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 14 Jul 2026 10:19:50 +0100 Subject: [PATCH 08/17] Test cases for handling different ordinal numbers created. --- .../2-practice-tdd/get-ordinal-number.test.js | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Sprint-3/2-practice-tdd/get-ordinal-number.test.js b/Sprint-3/2-practice-tdd/get-ordinal-number.test.js index adfa58560f..cb9eaf84b3 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.test.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.test.js @@ -18,3 +18,34 @@ test("should append 'st' for numbers ending with 1, except those ending with 11" expect(getOrdinalNumber(21)).toEqual("21st"); expect(getOrdinalNumber(131)).toEqual("131st"); }); + +test("should append 'nd' for numbers ending with 2", () => { + expect(getOrdinalNumber(2)).toEqual("2nd"); + expect(getOrdinalNumber(22)).toEqual("22nd"); + expect(getOrdinalNumber(132)).toEqual("132nd"); +}); + +test("should append 'rd' for numbers ending with 3", () => { + expect(getOrdinalNumber(3)).toEqual("3rd"); + expect(getOrdinalNumber(23)).toEqual("23rd"); + expect(getOrdinalNumber(133)).toEqual("133rd"); +}); + +test("should append 'th' for numbers ending with 4 -10", () => { + expect(getOrdinalNumber(4)).toEqual("4th"); + expect(getOrdinalNumber(7)).toEqual("7th"); + expect(getOrdinalNumber(10)).toEqual("10th"); +}); + +test("should append 'th' for numbers ending with 11 - 13", () => { + expect(getOrdinalNumber(11)).toEqual("11th"); + expect(getOrdinalNumber(12)).toEqual("12th"); + expect(getOrdinalNumber(13)).toEqual("13th"); +}); + +test("should append 'error' for invalid numbers", () => { + expect(getOrdinalNumber(0)).toEqual("error"); + expect(getOrdinalNumber(-1)).toEqual("error"); + expect(getOrdinalNumber(1.5)).toEqual("error"); + expect(getOrdinalNumber("5")).toEqual("error"); +}); \ No newline at end of file From 1fa6def41e0c4e5ac8074f48893680f1509a2c43 Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 14 Jul 2026 10:39:04 +0100 Subject: [PATCH 09/17] countChar function created to check for multiple occurrence of a char in a str. --- Sprint-3/2-practice-tdd/count.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 95b6ebb7d4..1674e59c8d 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,5 +1,12 @@ function countChar(stringOfCharacters, findCharacter) { - return 5 -} + let count = 0; + for (let i = 0; i < stringOfCharacters; i++) { + if (stringOfCharacters[i] === findCharacter) { + count++; + } else { + count = 0; + } + } +} module.exports = countChar; From d37292b7ed4e2990319dbde7ee4e26cfc98e53a3 Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 14 Jul 2026 11:14:51 +0100 Subject: [PATCH 10/17] .length method added to count char in a str --- Sprint-3/2-practice-tdd/count.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 1674e59c8d..7b68a2487f 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,12 +1,14 @@ function countChar(stringOfCharacters, findCharacter) { let count = 0; - for (let i = 0; i < stringOfCharacters; i++) { + for (let i = 0; i < stringOfCharacters.length; i++) { if (stringOfCharacters[i] === findCharacter) { count++; } else { - count = 0; + return count; } } + return count; } +console.log(countChar("bbbbb", "b")); module.exports = countChar; From 82538915648f10748bf616bc94b55d0a2826b1b0 Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 14 Jul 2026 14:18:16 +0100 Subject: [PATCH 11/17] repeatStr function created to check count times is str repeated. --- Sprint-3/2-practice-tdd/repeat-str.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Sprint-3/2-practice-tdd/repeat-str.js b/Sprint-3/2-practice-tdd/repeat-str.js index 2af0a2cea7..4a9bd35d93 100644 --- a/Sprint-3/2-practice-tdd/repeat-str.js +++ b/Sprint-3/2-practice-tdd/repeat-str.js @@ -1,7 +1,15 @@ -function repeatStr() { +function repeatStr(str, count) { + if (count < 0) { + throw new Error("Error"); + } // Your implementation of this function must *not* call String.prototype.repeat (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat). - // The goal is to re-implement that function, not to use it. - return "hellohellohello"; + //The goal is to re-implement that function, not to use it. + let repeatedStr = ""; + + for (let i = 0; i < count; i++) { + repeatedStr += str; + } + return repeatedStr; } module.exports = repeatStr; From 8979be1eadcbc009a0ef50558335af96f79fd52c Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 14 Jul 2026 14:23:19 +0100 Subject: [PATCH 12/17] Unnecessary code removed. --- Sprint-3/2-practice-tdd/count.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 7b68a2487f..0f92b6fe8b 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -4,11 +4,9 @@ function countChar(stringOfCharacters, findCharacter) { for (let i = 0; i < stringOfCharacters.length; i++) { if (stringOfCharacters[i] === findCharacter) { count++; - } else { - return count; } } return count; } -console.log(countChar("bbbbb", "b")); + module.exports = countChar; From 0e19677fe5ccd1149d96c089f26c6567157ae5dd Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 21 Jul 2026 10:33:57 +0100 Subject: [PATCH 13/17] Test case to handle negative numbers and throw an error fixed. --- Sprint-3/2-practice-tdd/repeat-str.test.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Sprint-3/2-practice-tdd/repeat-str.test.js b/Sprint-3/2-practice-tdd/repeat-str.test.js index a575a69b87..23f16aace9 100644 --- a/Sprint-3/2-practice-tdd/repeat-str.test.js +++ b/Sprint-3/2-practice-tdd/repeat-str.test.js @@ -21,7 +21,7 @@ test("should repeat the string count times", () => { // When the repeatStr function is called with these inputs, // Then it should return the original `str` without repetition. -test("should repeat the string count times", () => { +test("should repeat the string count 1 time", () => { const str = "hi"; const count = 1; const repeatedStr = repeatStr(str, count); @@ -33,8 +33,8 @@ test("should repeat the string count times", () => { // When the repeatStr function is called with these inputs, // Then it should return an empty string. -test("should repeat the string count times", () => { - const str = ""; +test("should repeat the string 0 time", () => { + const str = "hello"; const count = 0; const repeatedStr = repeatStr(str, count); expect(repeatedStr).toEqual(""); @@ -45,9 +45,8 @@ test("should repeat the string count times", () => { // When the repeatStr function is called with these inputs, // Then it should throw an error, as negative counts are not valid. -test("should repeat the string count times", () => { +test("should throw an error", () => { const str = "hello"; const count = -1; - const repeatedStr = repeatStr(str, count); - expect(repeatedStr).toEqual(""); + expect(() => repeatedStr(str, count)).toThrow(); }); From 74d5e9f35d341bcd92843a4c5f9717575a264a38 Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 21 Jul 2026 10:59:16 +0100 Subject: [PATCH 14/17] Function for first test case fir checking numbers ending with st implemented. --- Sprint-3/2-practice-tdd/get-ordinal-number.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/get-ordinal-number.js b/Sprint-3/2-practice-tdd/get-ordinal-number.js index f95d71db13..8226ab7654 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.js @@ -1,5 +1,10 @@ function getOrdinalNumber(num) { - return "1st"; + const lastDigit = num % 10; + const lastTwoDigits = num % 100; + if (lastDigit === 1 && lastTwoDigits !== 11) { + return `${num}st`; + } + return `${num}th`; } module.exports = getOrdinalNumber; From 42025c9871c9280c3ff8816be88bf7728fdbf7c2 Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 21 Jul 2026 11:06:29 +0100 Subject: [PATCH 15/17] A second if statement added into the function to check tests for numbers ending in nd. --- Sprint-3/2-practice-tdd/get-ordinal-number.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sprint-3/2-practice-tdd/get-ordinal-number.js b/Sprint-3/2-practice-tdd/get-ordinal-number.js index 8226ab7654..d14137e7d2 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.js @@ -4,6 +4,10 @@ function getOrdinalNumber(num) { if (lastDigit === 1 && lastTwoDigits !== 11) { return `${num}st`; } + if (lastDigit === 2 && lastTwoDigits !== 12) { + return `${num}nd`; + } + if return `${num}th`; } From ee69e69525de34c1e39d7f3b9d45eabcd5710606 Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 21 Jul 2026 11:11:40 +0100 Subject: [PATCH 16/17] A third if statement added to test numbers with ending in rd --- Sprint-3/2-practice-tdd/get-ordinal-number.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/get-ordinal-number.js b/Sprint-3/2-practice-tdd/get-ordinal-number.js index d14137e7d2..5ca0590890 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.js @@ -7,7 +7,9 @@ function getOrdinalNumber(num) { if (lastDigit === 2 && lastTwoDigits !== 12) { return `${num}nd`; } - if + if (lastDigit === 3 && lastTwoDigits !== 13) { + return `${num}rd`; + } return `${num}th`; } From 3590fb10720aa805043cb4e56b7987f813e5d8d5 Mon Sep 17 00:00:00 2001 From: russom Date: Tue, 21 Jul 2026 11:27:07 +0100 Subject: [PATCH 17/17] An if statement added to the function to check if num is not negative or not a whole number or not a string first thing --- Sprint-3/2-practice-tdd/get-ordinal-number.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Sprint-3/2-practice-tdd/get-ordinal-number.js b/Sprint-3/2-practice-tdd/get-ordinal-number.js index 5ca0590890..63e5698cfa 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.js @@ -1,15 +1,18 @@ function getOrdinalNumber(num) { + if (num <= 0 || !Number.isInteger(num) || typeof num !== "number") { + return "error"; + } const lastDigit = num % 10; const lastTwoDigits = num % 100; if (lastDigit === 1 && lastTwoDigits !== 11) { return `${num}st`; } - if (lastDigit === 2 && lastTwoDigits !== 12) { + if (lastDigit === 2 && lastTwoDigits !== 12) { return `${num}nd`; } - if (lastDigit === 3 && lastTwoDigits !== 13) { - return `${num}rd`; - } + if (lastDigit === 3 && lastTwoDigits !== 13) { + return `${num}rd`; + } return `${num}th`; }