Tell us what’s happening:
I cannot pass Test 6-10. Somehow I can’t manage to make the count – work? I’m not sure what I’m doing wrong. There’s some comments in the code for further details. Can someone direct me to the proper lesson Theory please. Thanks
Your code so far
let count = 0;
function cardCounter(card) {
if (typeof card === "number")
if (card >= 2 && card <= 6) {
count ++;
}
else if (card = 7, 8, 9) {
;
}
else if (card === 10) {
count --;
}
//can't get this to deduct for some reason
else if (typeof card === "string") {
if (card === "J"
|| card === "Q"
|| card === "K"
|| card === "A")
count --;
}
/* I think I'm returning the wrong thing?
not sure what to do*/
if (count > 0) {
return `${count} Bet`;
}
else if (count <= 0) {
return `${count} Hold`
}
}
console.log(cardCounter(10)); //logs 0 to console should be -1
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.3.1 Safari/605.1.15
Challenge Information:
Build a Card Counting Assistant - Build a Card Counting Assistant