Counting Cardscount:https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/counting-cards/

Ill look at other examples in the forums too

Your code so far


var count = 0;

function cc(card) {
  // Only change code below this line
  switch(card){
    case 2:count: count++, 'Bet';
        break;
    case 3:count:count++, 'Bet';
        break;
    case 4:count: count++, 'Bet';
        break;
    case 5:count: count++, 'Bet';
        break;
    case 6: count: count++, 'Bet';
    break;
    case 7:count: '0', 'Hold';
        break;
    case 8:count: '0', 'Hold';
        break;
    case 9: count: '0', 'Hold';
    break;
    case 10:count: 'count--', 'Hold';
    break;
    case 'J':count: 'count--', 'Hold';
    break;
    case 'Q'count: 'count--', 'Hold';
    break;
    case 'K'count: 'count--', 'Hold';
    break;
    case 'A':count: 'count--', 'Hold';
    break;
  }
  
  return "";
  // 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_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/counting-cards/

case 2:count: count++, 'Bet';

These lines are all syntactically invalid. They don’t mean anything in JavaScript.

Even if they did, you are always returning an empty string.

this might be better

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/counting-cards/

Try reviewing previous lessons on changing the value of a variable and on the return statement

1 Like