Using the switch function while counting cards

Tell us what’s happening:

can anyone kindly put me through this code, I have reviewed it a dozen times ,yet, I cant pass this test

**Your code so far**

var count = 0;

function cc(card) {
 switch(card){
   case 2:
   case 3:
   case 4:
   case 5:
   case 6:
     count ++;
     break;
     case 10:
     case "J":
     case "Q":
     case "K":
     case "A":
       count --;
       break;

 }
 var holdbet = "Hold";
 if (count > 0){
  holdbet = "Bet";
 }
 // Only change code below this line
return count + "" + holdbet;
 // 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/89.0.4389.90 Safari/537.36.

Challenge: Counting Cards

Link to the challenge:

You’re missing a space between count and holdbet.

Why did you put an empty string here?

Why the extra space here?

May I provide you an alternate solution to your coding problem? Let me know if you still need help. Thanks.

Please stop posting in random threads offering to give solutions.

Instead of posting your full working solutions, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

I seriously wouldn't mind

I am equally curious to find out why I can't pass this test

Hi there!

I’ve made some notes/comments to guide you.

//Include the Mid Cards
case 7:
case 8:
case 9:
count+= 0;
break;

//Make it a habit to use a ‘default’; the reason behind is that “what if ?” the end-user entered an invalid input, then without a ‘default’ return value – that would be misconstrued as a ‘valid Mid Card’.

default:
return card value "${card}" is not valid! Serve another card!;

//It’s best practice to include ‘else’ when using ‘if’; this gives you a better logical ‘visual’; although, js is very ‘forgiving’ and would allow the absence of ‘else {}’.

else {
return count + " Hold";
}

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

Ok, will do. I will simply give hints from the notes I had made for our js buddy.

Thanks.