Tell us what’s happening:
I was just wandering why my code (as seen below) won’t pass as being correct. It passes all 7 tests given.
Your code so far
var count = 0;
function cc(card) {
// Only change code below this line
if (card >=2&& card<=6){
count++;
} else if (card>=7 && card<=9){
count;
} else {
count--;
}
if (count > 0){
return (count + " bet");
} else {
return (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(4); cc(5); console.log(cc(6));
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/counting-cards