'Why is my JavaScript code not accepted as the right answer? [closed]

I am trying to do this Javascript exercise: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/counting-cards

I am wondering why the solution below is not an accepted answer:

let count = 0;

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

  if (low.includes(card)) {
    count += 1;
  }

  else if (high.includes(card)) {
    count -= 1;
  }

  let decision;

  if (count > 0) {decision = "Bet"}
  else {decision = "Hold"}

  return count + decision;
  // Only change code above this line
}

cc(2); cc(3); cc(7); cc('K'); cc('A'); 

When I am comparing it to accepted answers I don't see what they are doing differently. One thing that is not clear to me in the assignment is that should return be called every time or only after the last function call (cc('A');).



Solution 1:[1]

Add a space between count and decision

  return count + " " + decision;

Solution 2:[2]

You are giving an answer in the wrong format. Just missing the space between count and decision.

Incorrect:return count + decision;

Correct:return count +" "+ decision;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Chetan Ahirrao
Solution 2 Mohit Maroliya B17CS036