Tell us what’s happening:
Hi, this is my code, but the only check that doesn’t go is “After the cards 7, 8, then calling cardCounter(9) should return the string 0 Hold”
Thank you.
Your code so far
let count = 0;
function cardCounter(card) {
if (card < 7) {
count++;
} else if (card > 9 || card == "J" || card == "Q" || card == "K" || card == "A") {
count--;
}
if (card > 0) {
return count + " Bet";
} else {
return count + " Hold";
}
}
console.log(cardCounter());
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
Challenge Information:
Build a Card Counting Assistant - Build a Card Counting Assistant