Tell us what’s happening:
Describe your issue in detail here.
// What is wrong with this card counting function?? When I pass a high card value ( i.e, 10, “J”, “Q”, etc, etc…) the count variable does not decrease by 1 and does not return the running count + string “Hold”…
**Your code so far**
let count = 0;
function cc(card) {
// Only change code below this line
switch(card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;
case 10:
case "J":
case "Q":
case "k":
case "A":
count--;
break;
}
// I want to keep this if/else piece of code
is there something I'm missing here? */
if(count > 0) {
return count + " Bet";
} else {
return count + " Hold";
}
// Only change code above this line
}
cc(2); cc(3); cc(7); cc('K'); cc('A'); /* Also, can someone please explain how can I console.log out the result of this sequence of card numbers and explain the logic when I pass these card values in the function. Thanks in advance... */
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15
Challenge: Counting Cards
Link to the challenge: