Code is no work why<< questions

Tell us what’s happening:

Your code so far


var count = 0;

function cc(card) {
// Only change code below this line
//postive
case 2:
   day = "Bet";
  break;
case 3:
  day = "Bet";
  break;
case 4:
  day = "Bet";
  break;
case 5:
  day = "Friday";
  break;
case 6:
  day = "Bet";
  break
//0
case 7:
  day = "Hold";
  break;
case 8:
  day = "Hold";
  break;
case 9:
  day = "Hold";
  break;
//negative
case 10:
  day = "Sunday";
  break;
case 'J':
  day = "Monday";
  break;
    case 'Q':
  day = "Hold";
  break;
case 'K':
  day = "Hold";
  break;
    case 'A':
  day = "Hold";
  break;

}
/*
case 2, 3, 4, 5, 6
return "Bet"
else  card negative or zero 7, 8, 9, 10, 'J', 'Q', 'K', 'A'
return "Hold"
*/
//https://www.w3schools.com/js/js_switch.asp here works wy no here?

return "Change Me";
// 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.

Challenge: Counting Cards

Link to the challenge:

The function will then return a string with the current count and the string Bet if the count is positive, or Hold if the count is zero or negative.

  • your function does not return anything
  • you are not changing the count in the switch statement
  • you’ve created a new variable day instead of using count
  • you’re assigning random things to day (the task is not to assign days of the week to a random variable)

You are supposed to be:

  • changing the value of the variable count depending on what the value of card is.
  • returning the new value of count + the word “Bet” if count is a positive number.
  • returning the new value of count + the word “Hold” if count is zero or a negative number.
3 Likes

Senkora, please edit your recent (including this one) topics’ titles to be descriptive:

These are not useful titles, and it does not help, when you do not include any information/question in the Tell us what’s happening section.

A descriptive title announces the topic of the question clearly and succinctly. It is not the question itself.

Thank you.