let count = 0;
function cc(card) {
// Only change code below this lin
if ( card >= 2 && card <= 6) {
count++
} else if (card >= 7 && card <= 9) {
count += count;
} else {
count--
}
let result = '';
if (count > 0) {
result = 'Bet';
} else {
result = 'Hold'
}
return `${count} ${result}`
// Only change code above this line
}
cc(2); cc(3); cc(7); cc('K'); cc('A');
can you repeat how count
have to change for each card, and point out how you are doing that in your code?
If positive increment count
If 7, 8, 9
do nothing
If negative decrement count
you sure that’s what is happening? use some console.log()s and check it out
Its really best if you provide the link to the challenge you are working on and a brief description of where you are stuck in the body of your post.
This is the error I’m getting.
Cards Sequence 3, 7, Q, 8, A should return the string -1 Hold
Cards Sequence 2, J, 9, 2, 7 should return the string 1 Bet
Have you double checked what happens when the card is 7, 8, or 9?
I consoled logged it and it returns 4
… have you doubled checked what happens when the card is 7, 8, or 9?
Just passed the test. I’m blind as a vat. It was just count
not count += count;
Thanks
Sometimes our eyes just gloss over the bug
Definitely. I also have ADHD so it makes me even blinder haha
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.