Skip to content

Commit 8b3fd7a

Browse files
committed
Check if the Number(rank) works instead of parseint(rank, 10).
1 parent fb90283 commit 8b3fd7a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sprint-3/2-mandatory-rewrite/3-get-card-value.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ function getCardValue(card) {
3333
if (["K", "Q", "J"].includes(rank)) return 10;
3434

3535
// If rank is numeric (2-10), safely convert to number
36-
return parseInt(rank, 10);
36+
// we can use 'Number(rank)' instead of 'parseint(rank, 10)'
37+
return Number(rank);
3738
}
3839

3940
module.exports = getCardValue;

0 commit comments

Comments
 (0)