Having trouble passing the Counting Cards challenge

Hello, I am having the same problem as the original author of this post.

I wrote the card counting program using a switch statement followed by a couple of if statements like so:

var count = 0;

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

I feel like something is off with the logic I used in the program because I can get the answer I want if I input a single argument in the function but still cannot pass the challenge

Please tell me what I am doing wrong.

In the future, please create your own topic when you have specific questions about your own challenge code. Only respond to another thread when you want to provide help to the original poster of the other thread or have follow up questions concerning other replies given to the original poster.

The easiest way to create a topic for help with your own solution is to click the Ask for Help button located on each challenge. This will automatically import your code in a readable format and pull in the challenge url while still allowing you to ask any question about the challenge or your code.

Now that I got that out of the way, the problem with your solution is in your return statements. Your solution ends up returning values like “5Bet” and “-3Hold” instead of “5 Bet” and “-3 Hold”.

you are assigning the value +1 or -1, see the challenge description

and increment or decrement the global count variable according to the card’s value (see table)

@RandellDawson and @ilenia Thank you for the help and in the future I will use the “Ask for help” button like you suggested