[SOLVED] Counting card test won't pass

[SOLVED] Counting card test won't pass
0

#1

Hi there! So I tought my code was wrong, and searched the forums and passed the code I found there and it still does not let me pass the test and move on. Maybe I’m missing something so here is the code:

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 'A':
    case 'J':
    case 'Q':  
    case 'K': 
      count--;
      break;
  }
  // Only change code above this line
}
if(count > 0){
  return count + 'Bet';
}else{
  return count+ 'Hold';
}

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

Anyone who could help me?


#2

There are a few things off:

  • The if-else block should be inside the function. Check your braces.
  • Your strings won’t have a space in them.

#3

It worked now thank you!