Tell us what’s happening: I seem to be having trouble passing a card equaling ten through my script. I have tried using strict (===) and non-strict (==) comparisons, but neither seem to work for having the script recognize that the ten should decrease overall count.
All other parts of the script appear to be working as intended.
Help identifying the issue would be appreciated! Thanks!
Your code so far
var count = 0;
var decision = 0;
function cc(card) {
// Only change code below this line
if (card < 7) {
count++;
} else if (card > 6 || card < 10) {
count = count + 0;
} else if (card == 10 || card == "J" || card == "Q" || card == "K" || card == "A") {
count--;
}
if (count > 0) {
decision = "Bet";
} else decision = "Hold";
return count + " " + decision;
// Only change code above this line
}
// Add/remove calls to test your function.
// Note: Only the last will display
cc(10); cc("J"); cc("Q"); cc("K"); cc("A");
console.log(count);
**Your browser information:**
User Agent is: <code>Mozilla/5.0 (X11; CrOS x86_64 12371.75.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.105 Safari/537.36</code>.
**Challenge:** Counting Cards
**Link to the challenge:**
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/counting-cards