We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f9a21a9 commit 2fb1964Copy full SHA for 2fb1964
1 file changed
Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js
@@ -37,8 +37,23 @@ function getCardValue(card) {
37
const rank = card.slice(0, -1);
38
if (rank === "A") return 11;
39
if (rank === "J" || rank === "Q" || rank === "K") return 10;
40
+}
41
+
42
+if (
43
+ rank === "2" ||
44
+ rank === "3" ||
45
+ rank === "4" ||
46
+ rank === "5" ||
47
+ rank === "6" ||
48
+ rank === "7" ||
49
+ rank === "8" ||
50
+ rank === "9" ||
51
+ rank === "10"
52
+ ) {
53
+ return Number(rank);
54
+ }
55
-
56
+ throw new Error("Invalid card");
57
}
58
59
// The line below allows us to load the getCardValue function into tests in other files.
0 commit comments