I need help on this one friends

Tell us what’s happening:

Your code so far


var count = 0;

function cc(card) {
// Only change code below this line
const low = [2,3,4,5,6]
const mid = [7,8,9]
const high = [10,"J","Q","K","A"]


if(low.includes(card))
count++
if(high.includes(card))
count--


return count + (count>0? "Bet":"Hold");

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 (Linux; Android 8.1.0; itel A16 Plus) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Mobile Safari/537.36.

Challenge: Counting Cards

Link to the challenge:

If you add

console.log(cc());

at the end of your code, you can see what’s wrong.

you’re missing a space

1 Like

Thinking that the space is the problem but I have added the space still can’t pass what do you think I should do

What is your new code? I can’t help without seeing your code.

Seriously I have just been pardon for duplicate but here is the change I have effected and the result

Return count +(count>0? " Bet":" Hold"
console.log(cc());
//and the result is 0 Hold

That single change to your above code creates a passing solution for me.


You can create additional replies inside of a singe thread with updated code. We just ask that members not create additional threads about the same topic or challenge.

1 Like

About the code could it be a bug of coding with Android cause I believe if the change work for you so to my but it’s still there .

I don’t understand what you mean.

This is why I asked to see your full code so that I could verify that your newest version passes for me.

Iso how should I post to you without creating a new post or since I have made a new change I can post an no problem .

You should copy and paste your full code into a new reply in this thread and add backticks on new lines before and after your code.

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 (’).

You are allowed to post your updated code for this problem because it is on topic. That will help other forum users better diagnose the problem.

What you can’t do is open up a whole new topic and say “hey I still have an issue with this challenge can you help” even though there is a whole other topic you opened asking the exact same question. That is an example of duplicate topics which is a no no in the forum.

Hope that makes sense!

2 Likes

You have added a space to the wrong part.
You are really close but try adding a space somewhere else. Maybe earlier(hint)

1 Like