Counting Cards Task

Continuing the discussion from freeCodeCamp Challenge Guide: Counting Cards:

Exactly the same problem I’ve got. How do you input the cards to get an answer. From the code it seems only one variable can be inputted at a time.

Not exactly sure what you are asking? You call the function cc and pass an argument (a number between 2 and 10 or the letter A, J, K, or Q. Calling the function should change the global count variable and then your other logic will return the correct string depending on the new value of count.

I really don’t know how to put the question better but if check the topic, at the guidelines part it seems you’re required to pass more than one argument into the function which I think isn’t possible. Example how do I input 2,3,4 at once to get a return of “+3 Bet”. I really hope you understand what I’m asking

The function cc is only expecting a single argument each time it is called.

You would simply call the function 3 times:

cc(2); // returns "1 Bet" 
cc(3); // returns "2 Bet"
cc(4); // returns "3 Bet"

You could modify the function to accept one or more arguments, but the logic would be different and is unnecessary to pass this challenge.

1 Like

Thank you very much for the explanation. I get it now, I am extremely grateful.