Counting Cards >> What's wrong with my code? I can't see any error here but it's being stuck each time i submit. Please check my code and notice the error

Tell us what’s happening:

Your code so far

function cc(card) {
  // Only change code below this line
  switch(card) {
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
  if (count > 0) {
    return count + "Bet";
    return count + "Hold";

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36.

Link to the challenge:

Your error is one that I made doing it as well. It doesn’t actually say what to return if the count actually is at 0.

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

Make sure you still have the following line of code above your function:

var count = 0;

This will not completely solve your problem, because you need to look at your two return statements. The tests are expecting a space between the count and the word (Bet or Hold).

1 Like

ohhhooo !
I have wasted almost 1 hour for this :open_mouth:
Thank you @rmdawson71

Actually error was here - The tests are expecting a space between the count and the word (Bet or Hold).
Thank you.

1 Like

Below is a part of the instructions which deals with how to handle a zero count.

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.

I was referring to the code posted in the original post. I went the opposite route in solving it, and my code will not pass without the “=” in the if statement.

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