Tell us what’s happening:
// running tests
- You should use let to declare a global variable named count and set it to 0.
// tests completed
this message is being returned despite complying with all other conditions. i’m also declaring the global variable named count and set it to 0.
Your code so far
let count = 0;
function cardCounter(card) {
switch(card) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
count += 1;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count -= 1;
}
if (count > 0) {
return count + " Bet";
} else {
return count + " Hold";
}
}
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36
Challenge Information:
Build a Card Counting Assistant - Build a Card Counting Assistant