Am I on the right track so far on this challenge?

that sounds good! here it is:

return "0";

What if 0 isn’t the current number stored in the count variable? You want to return the current value of count, right? The function is supposed to increment or decrement the count based on the card passed in and then return the current value of count. How would you do that in the return statement?

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

why are you comparing card to count?

I’m not to sure, i thought that in the if function the condition would involve card.

Interesting, but what if there are multiple numbers assigned to the count value? That is what I’m kind of confused about.

there can be only one value for a variable, so there can’t be multiple values. But you don’t know which value it is.

True, so that’s kind of what I’m having trouble with, I assumed it may have been 1 since in the Count Change, the value’s increment by one but, however, when I put 1 Bet or 1 Hold in the return value in the if statement. It may be incorrect, since the little guide in the bottom left says there may be multiple returned values. (even if that’s not the case)

you need to use the variable count to build the returned string, not hardcode a number there

Oh i see, interesting

Hmm, I am not sure if it is working. when I put count in the return box in the if statement I don’t think anything changed

I don’t know what you changed if you don’t show

var count = 0;

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

 if(card === count -- || count ++) {
    return "count";

  } 

  

   switch(card) {
 case 2:
    count ++;
    break;
 case 3:
    count ++;
    break;
 case 4:
    count ++;
    break;
case 5:
    count ++;
    break;
case 6:
    count ++;
case 7:
case 8:
case 9:
case 10:
    count --;
    break;
case 'J':
    count --; 
    break;
case 'Q': 
    count --;
    break;
case 'K':
  count --;
  break;
case 'Z':
    count --;
    break;
case 'A':
  count --;
  break;

} 

  return "Change Me";
  // Only change code above this line
}

cc(2); cc(3); cc(7); cc('K'); cc('A');

there are big issues there, the least of which is that

this is not how you use a variable


ok, let’s roll back.

The first part of the function should change the value of count based on card, which you are sort of doing in the switch statement, so let’s take a look at it.

what do you want to do if the card is 7,8 or 9? right now it is executing this:

and if your card is 6
this

in a switch statement code is executed until a break is found

then, after you have changed count based on card, and only after, you need to satisfy this part of the instructions:

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. The current count and the player’s decision ( Bet or Hold ) should be separated by a single space.

Ohh i think i know what you mean. So maybe i should add more breaks, right?

yes, that would be necessary

ah ok, I’m still confused about what to do about the return though. I did put count as a value however I’m not sure if it did anything

if you change something you need to post your updated code

My bad

var count = 0;

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

 if(card === count -- || count ++) {
    return count;

  } 

  

   switch(card) {
 case 2:
    count ++;
    break;
 case 3:
    count ++;
    break;
 case 4:
    count ++;
    break;
case 5:
    count ++;
    break;
case 6:
    count ++;
    break;
case 7:
break;
case 8:
break;
case 9:
break;
case 10:
    count --;
    break;
case 'J':
    count --; 
    break;
case 'Q': 
    count --;
    break;
case 'K':
  count --;
  break;
case 'Z':
    count --;
    break;
case 'A':
  count --;
  break;

} 

  return "Change Me";
  // Only change code above this line
}

cc(2); cc(3); cc(7); cc('K'); cc('A');

again, the FIRST part of the function should deal with changing count, the SECOND part of the function with building the output string

to build the output string you forget about card, and use only count
following this:

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. The current count and the player’s decision ( Bet or Hold ) should be separated by a single space.