Basic JS: Counting Cards Help

Tell us what’s happening:
Hey guys.
I’m not sure why it isn’t allowing me to pass the challenge.
When I console.log all of the requirements my result is what is being expected but when I submit challenge I’m not getting anything correct.

Please help!

Your code so far


var count = 0;

function cc(card) {
 // Only change code below this line
switch(card) {
 case 2:
 case 3:
 case 4:
 case 5:
 case 6:
return count++
 break;

 case 7:
 case 8:
 case 9:
 return count += 0
 break;

 case 10:
 case "J":
 case "Q":
 case "K":
 case "A":
return count--
break;

}
 var holdBet = " Hold"
 if (count <= 0) {
   return count + " Hold"
 } else if (count <= 6) {
   return count + " Bet"
 }


 // Only change code above this line
}


cc(2); cc(3); cc(4); cc(5); cc(6);
console.log(cc())

Your browser information:

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

Challenge: Counting Cards

Link to the challenge:

1 Like

the function is being called by the tests with an argument, so try console.log(cc(5))

1 Like

Why? Should this need a condition? Is this condition correct?