I found a guide for this exercise which offers two possible solutions but interestingly, even after verifying that my code looks exactly like one of the solutions offered, it still doesn’t pass any of the tests… Anyone have any idea’s why this might be? Here’s my code:
function cc(card) {
// Only change code below this line
switch (card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count--;
break;
}
if (count > 0) {
return count + 'Bet';
} else {
return count + 'Hold';
}
// Only change code above this line
}
cc(2); cc(3); cc(7); cc('K'); cc('A');```
Do you mean have I tried running the code in the console? (Sorry, I’m still learning how to talk about this stuff.) I just did try it and it works, actually.
Ok, thank you. I just played with it a little more and found that it’s not working correctly after all. As it has been only incrementing and decrementing by 1 even if I pass in multiple arguments (as the tests do).
So you could look at the output. Did you look at the output? Did you compare it to the requested output? Do you see the small, single character difference?
Yours:
Requested:
0 Hold
Your output is different than the required output.