Skip to content

Commit 8f61c0f

Browse files
committed
Change function getCardValue to use Number instead
1 parent 6db1bca commit 8f61c0f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ function getCardValue(card) {
1515
return 11;
1616
}
1717

18-
const numValue = parseInt(rank, 10);
19-
if (numValue >= 2 && numValue <= 10) {
20-
return numValue;
21-
}
18+
const numeric = Number(rank);
19+
if (Number.isInteger(numeric) && numeric >= 2 && numeric <= 10) {
20+
return numeric;
21+
}
2222

2323
if (rank === "J" || rank === "Q" || rank === "K") {
2424
return 10;

0 commit comments

Comments
 (0)