Counting Cards Help Please

Hi! I’ve been puzzling over this code and have been unable to figure out where I went wrong. I can’t seem to move past this and would appreciate some fresh eyes. Thanks in advance!

Here’s my code:
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++;
break;
case 7:
case 8:
case 9:
count +=0;
break;
case 10:
case “J”:
case “Q”:
case “K”:
case “A”:
count–;
break;
default:
}
if (count <= 0) {
return count + “Hold”;
} else {
return count + “Bet”;

// Only change code above this line
}
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(4); cc(5); cc(6);

1 Like

You need a space before hold and bet:
return count + " Hold"
return count + " Bet".

Right now it returns “4Hold” / “4Bet” (assuming count =4) which is not “4 Hold” / "4 Count"
I had the same problem the first time.

1 Like

HOORAY IT WORKED!! Thank you! I was tearing my hair out trying to figure that out. Really appreciate it!

This is my solution for the problem

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++;
break;
case 7:
case 8:
case 9:
break;
case 10:
case “J”:
case “Q”:
case “K”:
case “A”:
count–;
break;
}

if(count >= 1){
  return count + " Bet";
}else if(count <= -1){
  return count + " Hold";
}else{
  return "0 Hold";
}

// Only change code above this line
}