Why does my code not pass the test for Counting Cards?

Tell us what’s happening:
Describe your issue in detail here.
When I run test on my code I get:

Cards Sequence 2, J, 9, 2, 7 should return the string
1 Bet
Cards Sequence 2, 2, 10 should return the string
1 Bet

But when I run the function myself using those values the console gives me 1 Bet. I’m just having a hard time figuring why this doesn’t work compared to the standard solution because of that. Can anyone tell me why? thanks in advance.

  **Your code so far**

let count = 0;

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


return answer;
// Only change code above this line

cc(2); cc(3); cc(7); cc('K'); cc('A');

console.log(cc(7, 8, 9))
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36

Challenge: Counting Cards

Link to the challenge:

The returned answer has nothing to do with the value of the card, only the value of the count.

Whether or not the function should return a string including “Bet” or “Hold” needs to be determined by checking the value of count. Your doing it based on the value of card.

Oh ok, I see what you’re talk about now. Thanks for the help.

I’m glad I could help. Happy coding!

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