Basic JavaScript - Counting Cards

Tell us what’s happening:
Describe your issue in detail here.
I write this code for an test on the website bat it doesn’t work, Someone can help me?
Your code so far

let count = 0;

function cc(card) {
  // Only change code below this line
  case 2:
  case 3:
  case 4:
  case 5:
  case 6:
  count= count++;
  case 10:
  case "J":
  case "Q":
  case "K":
  case "A":
var variabile1 = "Hold";
 if(count > 0) {
//variabile1 = "Bet";
}else if(count <=0){
 // variabile1 = "Hold";

  return count + "" + variabile1;
  // 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 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Safari/605.1.15

Challenge: Basic JavaScript - Counting Cards

Link to the challenge:

Hi there and welcome to our community!

This is not how you increment a variable. You have decremented count correctly further down in your code, so just use the same syntax to increment and it will work.

Then you need to restore your if ... else statement, as you have commented out code which is required to return the correct string value (i.e. “Bet” or “Hold”).


…will return 5Hold (for example). You should have a space between the value and the string.

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