Tell us what’s happening:
Describe your issue in detail here.
Your code so far
This is the place where I lost all hope. I dont even know what question to ask in order to ask a question.
Can anyone point to a good tutorial (already tried the useful programer) that might help me start to understand this one?
Thanks so much
let count = 0;
function cc(card) {
// Only change code below this line
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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Can you describe to us how you would solve this? What would you do inside the function? You don’t need to use any code. Just describe in words how the function should work.
i guess im not really sure how card counting works- so im not sure what the goal of the exercise is… is it that if you end up with a running tally of “x” you would hold and if you have a running tally of “y” you would not hold? like, if your tally of cards is > 0 you would bet and if it is < 0 you would hold?
You really don’t need to know anything about card counting to complete this. The goal of this exercise is to get you to use javascript techniques you have already covered, not to teach you how to count cards
You only need to understand that the function will be passed certain values (the numbers 2 through 10 and the letters J, Q, K, A. And then the instructions tell you what to do depending on which of those values is passed in, and what to return based on the value of count.
If you understand the above then you have enough to complete this challenge. So now you need to explain what you would do inside the function in order to complete it.
“It will receive a card parameter, which can be a number or a string, and increment or decrement the global count variable according to the card’s value (see table).”
The count variable defined above the function is the way to keep track of the count.
lol ive been staring at this thing so long i kind of havent even looked at the code - ok so my bad… haha and thank you for helping me btw- ok so let count = 0, then create the function? and the function could loop though each card in an array?
I’m not going to give you much hints on how to actually do this because I don’t want to deprive you of the fun of figuring it our on your own. But I will tell you that my solution would probably not involve using an array.