Why this is not working for this exercise?

Tell us what’s happening:

  **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:
 count ++;
case 10:
case "J":
case "Q":
case "K":
case "A":
 count --;
var holdbet = 'Hold'
if(count > 0) {
return 'Bet'
return count + " " + holdbet;
// 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_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15.

Challenge: Counting Cards

Link to the challenge:

Your return value is incomplete.

This statement causes the function to return the string value Bet. But that’s not what you want to return. Remember that the return statement will jump out of a function immediately.
You have this

return count + " " + holdbet;

You want to use this return statement. Make the variable holdbet equal to Hold or Bet.

Thank you all, I finally got what it was missing…

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.