Counting cards help FCC

Counting cards help FCC
0

#1

I do not understand what i am writing wrong !!! :frowning:
Someone please look at my code and tell me what i did wrong .

var count = 0;

function cc(card) {
  // Only change code below this line
  if (card >= 2 && card <= 6 ) {
    count++;

  }else if (card >= 7 && card <= 9) {
    count +=0;
  }else if (card === 10 || card === "J" || card === "Q" || card === "K" || card === "A") {
    card--;
  } if (count > 0) {
  return card + "Bet"
  }else if (count <0)
  
  return count + "Hold";
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');

#2

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

You have several issues in your current solution.

Be mindful that of the values you are returning. Should you be return card or count plus a string?

Also, make sure you are always either increasing count or decreasing count and no other variable.

Finally, make sure the final value returned has a space between the count value and the applicable string.