Tell us what’s happening:
Hi, I am using the below code and don’t understand why it isn’t working. Any suggestions would be helpful. Thanks
Your code so far
var count = 0;
function cc(card) {
// Only change code below this line
if(card > 1 && card < 7) {
count = count++;
} else if (card === 10 || card === String) {
count = count--;
}
count > 0 ? count + 'Bet' : count + 'Hold';
// Only change code above this line
}
// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134
.
Challenge: Counting Cards
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/counting-cards