i don’t find where is the probleme please need help:
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 "A":
count--;
break;
}
if (count > 0){
return count + " bet";
} else {
return count + " hold";
}
// Only change code above this line
}
Hello friends,
Decided to stick to this topic rathen than creating a similar one.
I have a similar solution of this Blackjack counting cards task. And it passes all the tests succesfully. Also I took the last piece of code and added console.log to it to see what it returns.
and it returns as many outputs as many arguments we have for our function:
cc(2); cc(3); cc(4); cc(5); cc(6);
returns
1 Bet
2 Bet
3 Bet
4 Bet
5 Bet
Looks like we have 5 outputs instead of one. Of course we know that out of these 5 the last one is the one we need to pass the the test succesfully. The question is: how come that in order to pass the test only the final (and correct) output is taken into consideration? Why other 4 are ignored?