Counting Card Problems, Help!

Tell us what’s happening:
I don’t even understand this Counting card challenge, and for some reasons, the hint didn’t help matters, neither did watching the video or googling. Where did I get it wrong, please?

``````  **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;
return "5 Bet";
case 10:
case 'J':
case 'Q':
case 'k':
case 'A':
count --;
break;
return "-5 Hold";
}
return "Change Me";
// 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36`

Challenge: Counting Cards

the only thing that your function returns is `"Change me!"`

and make sure to check the case of the letter cards.
Also, you are missing half of the problem

you have two parts of the problem that need to be solved in two different parts of the function

the first is this, and it says what to do with `count` depending on `card`

You will write a card counting function. It will receive a `card` parameter, which can be a number or a string, and increment or decrement the global `count` variable according to the card’s value (see table).

The second part of the function will determine the output based on the value of `count`

The function will then return a string with the current count and the string `Bet` if the count is positive, or `Hold` if the count is zero or negative. The current count and the player’s decision ( `Bet` or `Hold` ) should be separated by a single space.

Okay, l think I get you. Let me implement this first…

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.