Counting Cards excercise help

Tell us what’s happening:
I think maybe the issue is with the console.log statement or is the logic not right?. Help.

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:
       console.log(card++, "Bet");
      break;
    case 7:
    case 8:
    case 9:
      console.log(0, "Hold");
      break;
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      console.log(card--, "Hold");
      break;
      
      
      
  }
  
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0.

Link to the challenge:
https://www.freecodecamp.org/challenges/counting-cards

You’re on the right path, just check the question carefully. At the moment you’re not manipulating the count variable. The goal of this challenge is to increase or decrease the count variable based on the card given as input. Then, the function should return the count and a Hold or Bet string based on the value of the count.

1 Like