Tell us what’s happening:
I can’t figure what why my code is wrong. What am I missing here?
Your code so far
var count = 0;
function cc(card) {
// Only change code below this line
if (card == 1 || 2 || 3 || 4 || 5 || 6) {
count += 1;
} else if (card == 7 || 8 || 9) {
count += 0;
} else if (card == 10 || "J" || "Q" || "K" || "A") {
count += 1;
} else {
count += 0;
}
if (count > 0){
return count + " Bet";
} else {
return count + " Hold";
}
return "Change Me";
// 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');
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/counting-cards