Counting Cards Sovling Issue?

Tell us what’s happening:
Can someone help me understand what I’m missing here to get these parts correct? Is it along the lines of adding and if/else statement or is something wrong with the switch statement that everything else passes but those two parts?

Cards Sequence 2, J, 9, 2, 7 should return the string

1 Bet

Cards Sequence 2, 2, 10 should return the string

1 Bet
  **Your code so far**

let count = 0;

function cc(card) {
// Only change code below this line
switch (card) {
  case 2:
    count++
    return count + " Bet"
  case 3:
    count++
    return count + " Bet"
  case 4:
    count++
    return count + " Bet"
  case 5:
    count++
    return count + " Bet"
  case 6:
    count++
    return count + " Bet"
    break; 
  case 7:
    count
    return count + " Hold"
  case 8:
    count
    return count + " Hold"
  case 9:
    count
    return count + " Hold"
    break
  case 10:
    count--
    return count + " Hold"
  case "J":
    count--
    return count + " Hold"
  case "Q":
    count--
    return count + " Hold"
  case "K":
    count--
    return count + " Hold"
  case "A":
    count--
    return count + " Hold"
  }

return cc(card);
// 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; rv:100.0) Gecko/20100101 Firefox/100.0

Challenge: Counting Cards

Link to the challenge:

You should log these arguments and see what your function returns, instead of that string.

You can’t decide to return Bet or Hold based on the current card value (unless it’s the only card so far); you have to determine whether to bet or hold based on the value of count.

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