Counting Cards challenge issues

Tell us what’s happening:
Good day to you all. English isn’t my mother tongue, so I’m sorry for any inconveniences. I’ve tried this challenge for 1 hours, and read the solutions. But I don’t know how to solve these issues. Can you guys explain why I can’t finish this challenge, please? Thank you all!
Cards Sequence 7, 8, 9 should return the string 0 Hold
Cards Sequence 3, 7, Q, 8, A should return the string -1 Hold
Cards Sequence 2, J, 9, 2, 7 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: case 3: case 4: case 5: case 6:
 count = count + 1;
 break;
 case 7: case 8: case 9:
 count = count + 0;
 case 10: case 'J': case 'Q': case 'K': case 'A':
 count = count - 1
}
 if (count > 0)
   return count + " Bet";
 else return count + " Hold";
// Only change code above this line
}

cc(2); cc('J'); cc(2); cc(9); cc(7);
  **Your browser information:**

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

Challenge: Counting Cards

Link to the challenge:

I think you are missing one break.

1 Like

Guys, I think I figured out what the issues were. I didn’t add the “break” lines in my code. Thanks again!

Thanks so much for the reply! When I read my code again, I realized that I missed 2 breaks. When I added it, boom! Challenge completed. Thanks again, mate :smiley:

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