Card counting code not running

Tell us what’s happening:
Greetings. Am stuck on this challenge and i can’t see the fault in my code. please i need help. thanks.
Your code so far


var count = 0;

function cc(card) {
// Only change code below this line
switch (card) {
case 2: 
case 3: 
case 4: 
case 5: 
case 6: 
count++; break;
 
case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
break; 
}
if (count > 0) {
return count + " bet";
}
else if (count <= 0){
return count + " hold";
}
else { 
return "Change me"
}

// Only change code above this line
}

cc(2); cc(3); cc(7); cc('K'); cc('A');
  **Your browser information:**

User Agent is: Mozilla/5.0 (Linux; Android 4.4.2; ECHO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.99 Safari/537.36.

Challenge: Counting Cards

Link to the challenge:

Hi @biekings !

Welcome to the forum!

Two things.

You don’t need this part

and capitalization matters here

You can also rewrite this as an else clause instead of an else if.

But the test will accept either answer :grinning:

Thank you very much. capitalization was the problem.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.