title: Counting Cards Code Explanation
body: <p>I am doing the FreeCodeCamp courses and am confused as to why my code doesn't work. It seems to be a messier version of the correct answer.  Below is the correct answer and underneath that is mine.  I just want to understand.</p>
  
  <p>Here is the correct answer:</p>
  
  <pre><code>var count = 0;
  
  function cc(card) {
    {
     case 2:
     case 3:
     case 4:
     case 5:
     case 6:
    return count++;
     case 7:
     case 8:
     case 9:
    return count;
     case 10:
     case 'J':
     case 'Q':
     case 'K':
     case 'A':
    return count--;
   }
  }
  </code></pre>
  
  <p>Here is my answer:</p>
  
  <pre><code>var count = 0;
  
  function cc(card) {
    // Only change code below this line
    switch (card) {
      case 2:
        return count + 1;
      case 3:
        return count + 1;
      case 4:    
        return count + 1;
      case 5:
        return count + 1;
      case 6:
        return count + 1;
      case 7:
        return count + 0;
      case 8:
        return count + 0;
      case 9:
        return count + 0;
      case 10:
        return count - 1;
      case 'J':
        return count - 1;
      case 'Q':
        return count - 1;
      case 'K':
        return count - 1;
      case 'A':
        return count - 1;
    }
    if (count &lt;= 0){
      return count + " hold";
    } else {
      return count + " bet";
  }
  </code></pre>