Tell us what’s happening:
Build a Card Counting Assistant
All tests passes (Completed the challenge) but not understanding the test cases .
My test case for this test
Passed:9. After the cards 2, 2, then calling cardCounter(10) should return the string 1 Bet. runs -1 Hold. Or maybe I dont understand the process. I just read the instructions, wrote the code and passed the challenge. Can anyone help me understand the test by saying after the cards, 2,2?
Your code so far
let count = 0
const cardCounter = card => {
if (card >= 2 && card <= 6) {
count++;
} else if (card >=7 && card <=9) {
count;
} else if (card === 10 || card === "J" || card === "Q" || card === "K" || card === "A") {
count--;
}
if (count > 0) {
return `${count} Bet`
} else if (count <= 0) {
return `${count} Hold`
}
}
console.log(cardCounter(2));
console.log(cardCounter(3));
console.log(cardCounter(4));
console.log(cardCounter(5));
console.log(cardCounter(6));
console.log(cardCounter(7));
console.log(cardCounter(8));
console.log(cardCounter(9));
console.log(cardCounter(10));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Challenge Information:
Build a Card Counting Assistant - Build a Card Counting Assistant