I wrote counting cards as a function and past all of the the test except the 7, 8 ,9 card test. It continues to return “0 Bet” and no matter how I think of changing it it still returns the same answer. Can someone please explain to me what is going on and what I am doing wring. Thank you for your time.
Your code so far
function cc(card) {
// Only change code below this line
if((card == 2) || (card == 3) || (card == 4) || (card == 5) || (card == 6)){
count ++;
} else if ((card == 7) || (card == 8) || (card == 9)){
count = count;
} else if((card == 10) || (card == 'J') || (card == 'Q') || (card == 'K') || (card == 'A')) {
count--;
}
if(card >= 1) {
return (count + " Bet");
} else if(count <= 0) {
return (count + " Hold");
}
//return "Change Me";
// Only change code above this line
}
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0
.
Link to the challenge:
https://www.freecodecamp.org/challenges/counting-cards