# Have I completed this challenge correctly?

I’m not sure if the way I’ve completed this challenge is the right way? As some things are not working such as the codes not resetting each time, the hold and bet strings are not going in the right place.

``````var count = 0;

function cc(card) {

if (card > 1 && card <= 6){

count ++;

return count + " Bet";

}

else if (card >= 7  && card <= 9){

return count + " Hold";

}

else if(card == 10, 'J', 'Q', 'K', 'A'){

count --;

return count + " Hold";

}

}
``````

Just watched the video this was very simple, I forgot that i could use “case”

``````var count = 0;

function cc(card) {

switch(card) {

case 2:

case 3:

case 4:

case 5:

case 6:

count++; // Cards from 2 to 6, add 1 each time

break;

case 10:

case "J":

case "Q":

case "K":

case "A":

count--; // Cards from 10 to A, Subtract 1 each time

break;

}

var holdbet = "Hold"

if (count > 0) {

holdbet = "Bet"

}

return count + " " + holdbet;

}

cc(2); cc(3); cc(7); cc('K'); cc('A'); // Returns 1
``````

the issue is that you are using the value of `card` to determine if the returned value needs to contain `Bet` or `Hold`
instead you need to use the value of `count` to determine that

You’re supposed to use the value of the card. Then increment/decrement count and use THAT to return either hold or bet, which he/she did.

1 Like

Your solution is fine! My first solution was a lot messier. Remember there are many ways to code a certain thing, and just because you didn’t come up with the same solution as the video doesn’t mean you’re “wrong”. In this case, if statements work just as fine as switch/case statements!

1 Like

not in the first post in this thread

1 Like

Sorry for not replying, thank you both for the help