Skip to content

Commit ff38621

Browse files
committed
changed the inequality sign and made the value a string as it should be.
1 parent 18c3849 commit ff38621

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎practice-tdd/get-ordinal-number.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
export function getOrdinalNumber(num) {
22
let numStr = num.toString();
3-
if (num <= 0 || num == " " || numStr.includes(".")) {
3+
if (num <= 0 || num == "" || numStr.includes(".")) {
44
throw new Error("Invalid Input");
55
}
66

7-
if (numStr.slice(-1) == "1" && numStr.slice(-2) != 11) {
7+
if (numStr.slice(-1) == "1" && numStr.slice(-2) !== "11") {
88
return `${num}st`;
99
}
1010

11-
if (numStr.slice(-1) == "2" && numStr.slice(-2) != 12) {
11+
if (numStr.slice(-1) == "2" && numStr.slice(-2) !== "12") {
1212
return `${num}nd`;
1313
}
14-
if (numStr.slice(-1) == "3" && numStr.slice(-2) != 13) {
14+
if (numStr.slice(-1) == "3" && numStr.slice(-2) !== "13") {
1515
return `${num}rd`;
1616
}
1717

0 commit comments

Comments
 (0)