Counting Cards Issue1000

Tell us what’s happening:
What’s wrong with this code? I don’t get it…

let count = 0;

function cc(card) {
// Only change code below this line

switch (card) {

case 2,3,4,5,6: count++;
break;
case 10,"J","Q","K","A": count--;
break;
}
if (count <= 0) return count+ " Hold";
else return count+ " Bet";


// Only change code above this line
}

cc(2); cc(3); cc(7); cc('K'); cc('A');
  **Your browser information:**

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0

Challenge: Counting Cards

Link to the challenge:

This isn’t a valid case statement for a switch.

so it should be:

case 2
case 3
case 4
case 5
case 6 :

Well, lets look it up to be sure:

ok, great
many thanks!

1 Like