Counting Cards challenge input issue

Tell us what’s happening:
Hello,

I do not understand how your input gets into the program because I am only provided with card variable both in the function ( the part which I am not supposed to change) and in the part where you check the code:
cc(2); cc(3); cc(7); cc('K'); cc('A');
My output for these values are as follows:

1 Bet
2 Bet
2 Bet
1 Bet
0 Hold

because my code only expects one value, and of course the error message appears from your site (I cannot input all the messages because the character limit is reached):

Cards Sequence 2, 3, 4, 5, 6 should return 5 Bet

which tells me that your input is an array?

So to make this short, my question is how does your input look like? I expected cc(2) to be just that, not cc(2,3,4,5,6)

Your code so far


var count = 0;

function cc(card) {
// Only change code below this line
if (card<=6 && card >=2){
  count+=1;
} 
else if(card>=7 && card<=9){
  count+=0;
}
else {
  count-=1;
}

if (count>0){
  return count+"Bet";
}
else if (count<=0){
  return count+"Hold";
}

// 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; rv:80.0) Gecko/20100101 Firefox/80.0.

Challenge: Counting Cards

Link to the challenge:

No, it’s just like this:

each function called sequentially.

considering that count is global, then the effect is given by the various functions called one after the other

your issue is that these are not your outputs:

but these

You won’t believe this… I already made the change in IDE, but forgot to do so here.
Even so, I still didn’t understand why this worked the way it did until you brought to my attention the fact that the variable is global. Now I understand why every time the function is called, the count keeps track of the previous function calls, therefore I am shown these results.