Hello everyone! I just recently joined and following through JS course. I’ve ran into some trouble with the Card Counting Challenge. Could someone explain me, why the following code does not work properly:
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 > 0) {
return count + ' Bet';
} else {
return count + ' Hold';
}
I’ve checked the guide page, and I believe my code is nearly identical to what is described in the guide, though the output I receive is not correct, and I can’t pass the tests. Thanks in advance.
When I removed console.log, the program worked fine, and passed the tests. Nevertheless, thanks for your reply.
I now encountered difficulties with another challenge, the Record Collection. I wonder if you could take a look at that, I could send the link.
I’m ready.
But it will be better for your problem solving skills to fake it until you make it.
Try to figure out which test did not pass and adapte your code.
Test your code in the devtools of your browser ctrl+shift+i