Help Please! Card Counting Challenge - Javascript


#22

i used the switch case statements,
althought the answer is always right. but still i cannot pass it, maybe i should use relation operators.
This is my code:

var count = 0;

function cc(card) {
  // Only change code below this line

  
  var decision; var answer;
  switch(card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      count = count + 1;
      break;
    case 7:
    case 8:
    case 9:
      count = count + 0;
      break;
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      count = count - 1;
      break;
    default:
      console.log("Invalid input");
  }
  
  
  if(count > 0){
    decision = " bet";
    
    
  }else{
    decision = " hold";
  }
  
  answer = count + decision;
  
  return answer;
  // Only change code above this line
}


// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(4); cc(5); cc(6);

#23

Review the instructions again, because your decision assignments are not the same as expected. Yours are all lowercase.


#24

Ohh thank you so much , it worked :slight_smile: