Why doesnt my code work ? It returns the correct value however it says the task is not completed? Any issues with my code? What’s wrong? Works pretty well to me
Your code so far
let sum = 0;
function cc(card) {
// Only change code below this line
if (card >=2 && card <=6) {
sum +=1;
}
else if (card >6 && card <=9) {
}
else {
sum -=1;
}
var n = ''
if (sum > 0) {
n = ' Bet'
return sum + nig}
else if (sum <= 0) {
n = ' Hold'
return sum + n};
}
cc(1); cc(1); cc(1); cc(1); cc(5);
console.log(cc(10))
Challenge: Basic JavaScript - Counting Cards
Link to the challenge: