<p dir="auto">Challenge <a href="http://www.freecodecamp.com/challenges/counting-cards#?solution=var%20count%20%3D%200%3B%0A%0Afunction%20cc%28card%29%20%7B%0A%20%20%2F%2F%20Only%20change%20code%20below%20this%20line%0A%20%20switch%28card%29%7B%0A%20%20%20%20case%202%3A%0A%20%20%20%20case%203%3A%0A%20%20%20%20case%204%3A%0A%20%20%20%20case%205%3A%0A%20%20%20%20case%206%3A%0A%20%20%20%20%20%20count%20%2B%3D%201%3B%0A%20%20%20%20%20%20break%3B%0A%20%20%20%20case%207%3A%0A%20%20%20%20case%208%3A%0A%20%20%20%20case%209%3A%0A%20%20%20%20%20%20count%20%3D%200%3B%0A%20%20%20%20%20%20break%3B%0A%20%20%20%20case%2010%3A%0A%20%20%20%20case%20'J'%3A%0A%20%20%20%20case%20'Q'%3A%0A%20%20%20%20case%20'K'%3A%0A%20%20%20%20case%20'A'%3A%0A%20%20%20%20%20%20count%20-%3D%201%3B%0A%20%20%20%20%20%20break%3B%0A%20%20%7D%0A%20%20%0A%20%20if%28count%20%3D%3D%205%29%7B%0A%20%20%20%20return%20%225%20Bet%22%3B%0A%20%20%7D%0A%20%20%0A%20%20else%20if%20%28count%20%3D%3D%3D%200%29%7B%0A%20%20%20%20return%20%220%20Hold%22%3B%0A%20%20%7D%0A%20%20%0A%20%20else%20if%20%28count%20%3D%3D%20-5%29%7B%0A%20%20%20%20return%20%22-5%20Hold%22%3B%0A%20%20%7D%0A%20%20%0A%20%20else%7B%0A%20%20%20%20return%20%22-1%20Hold%22%3B%0A%20%20%7D%0A%20%20%0A%20%20%0A%20%20%2F%2F%20Only%20change%20code%20above%20this%20line%0A%7D%0A%0A%2F%2F%20Add%2Fremove%20calls%20to%20test%20your%20function.%0A%2F%2F%20Note%3A%20Only%20the%20last%20will%20display%0Acc%282%29%3B%20cc%283%29%3B%20cc%287%29%3B%20cc%28'K'%29%3B%20cc%28'A'%29%3B%0A" rel="nofollow">Counting Cards</a> has an issue.<br>
User Agent is: <code class="notranslate">Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.103 Safari/537.36</code>.<br>
Please describe how to reproduce this issue, and include links to screenshots if possible.</p>
<p dir="auto">My code:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var count = 0;

function cc(card) {
  // Only change code below this line
  switch(card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      count += 1;
      break;
    case 7:
    case 8:
    case 9:
      count = 0;
      break;
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      count -= 1;
      break;
  }

  if(count == 5){
    return &quot;5 Bet&quot;;
  }

  else if (count === 0){
    return &quot;0 Hold&quot;;
  }

  else if (count == -5){
    return &quot;-5 Hold&quot;;
  }

  else{
    return &quot;-1 Hold&quot;;
  }


  // 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');
"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">count</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span>

<span class="pl-k">function</span> <span class="pl-en">cc</span><span class="pl-kos">(</span><span class="pl-s1">card</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-c">// Only change code below this line</span>
  <span class="pl-k">switch</span><span class="pl-kos">(</span><span class="pl-s1">card</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
    <span class="pl-k">case</span> <span class="pl-c1">2</span>:
    <span class="pl-k">case</span> <span class="pl-c1">3</span>:
    <span class="pl-k">case</span> <span class="pl-c1">4</span>:
    <span class="pl-k">case</span> <span class="pl-c1">5</span>:
    <span class="pl-k">case</span> <span class="pl-c1">6</span>:
      <span class="pl-s1">count</span> <span class="pl-c1">+=</span> <span class="pl-c1">1</span><span class="pl-kos">;</span>
      <span class="pl-k">break</span><span class="pl-kos">;</span>
    <span class="pl-k">case</span> <span class="pl-c1">7</span>:
    <span class="pl-k">case</span> <span class="pl-c1">8</span>:
    <span class="pl-k">case</span> <span class="pl-c1">9</span>:
      <span class="pl-s1">count</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span>
      <span class="pl-k">break</span><span class="pl-kos">;</span>
    <span class="pl-k">case</span> <span class="pl-c1">10</span>:
    <span class="pl-k">case</span> <span class="pl-s">'J'</span>:
    <span class="pl-k">case</span> <span class="pl-s">'Q'</span>:
    <span class="pl-k">case</span> <span class="pl-s">'K'</span>:
    <span class="pl-k">case</span> <span class="pl-s">'A'</span>:
      <span class="pl-s1">count</span> <span class="pl-c1">-=</span> <span class="pl-c1">1</span><span class="pl-kos">;</span>
      <span class="pl-k">break</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>

  <span class="pl-k">if</span><span class="pl-kos">(</span><span class="pl-s1">count</span> <span class="pl-c1">==</span> <span class="pl-c1">5</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-s">"5 Bet"</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>

  <span class="pl-k">else</span> <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">count</span> <span class="pl-c1">===</span> <span class="pl-c1">0</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-s">"0 Hold"</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>

  <span class="pl-k">else</span> <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">count</span> <span class="pl-c1">==</span> <span class="pl-c1">-</span><span class="pl-c1">5</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-s">"-5 Hold"</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>

  <span class="pl-k">else</span><span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-s">"-1 Hold"</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>


  <span class="pl-c">// Only change code above this line</span>
<span class="pl-kos">}</span>

<span class="pl-c">// Add/remove calls to test your function.</span>
<span class="pl-c">// Note: Only the last will display</span>
<span class="pl-en">cc</span><span class="pl-kos">(</span><span class="pl-c1">2</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-en">cc</span><span class="pl-kos">(</span><span class="pl-c1">3</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-en">cc</span><span class="pl-kos">(</span><span class="pl-c1">7</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-en">cc</span><span class="pl-kos">(</span><span class="pl-s">'K'</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-en">cc</span><span class="pl-kos">(</span><span class="pl-s">'A'</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">I don't understand how my code solves the problem. Yet it solves all the challenges required to pass the waypoint. I sort of gamed it. I don't believe my code is right. So this waypoint is probably bugged and needs to be reframed. What do you think, guys?</p>
<p dir="auto">Challenge <a href="http://www.freecodecamp.com/challenges/counting-cards#?solution=var%20count%20%3D%200%3B%0A%0Afunction%20cc%28card%29%20%7B%0A%20%20%2F%2F%20Only%20change%20code%20below%20this%20line%0A%20%20var%20bet%20%3D%20''%3B%0A%20%20if%28card%3C%3D6%29%7B%0A%20%20%20%20count%20%2B%2B%3B%0A%20%20%7D%20else%20if%20%28!%28card%3C%3D9%29%29%7B%0A%20%20%20%20%20%20count%20--%3B%0A%20%20%7D%0A%20%20bet%20%3D%20count%20%3E%200%3F%20'%20Bet'%3A'%20Hold'%3B%0A%20%20return%20count%20%2B%20bet%3B%0A%20%20%2F%2F%20Only%20change%20code%20above%20this%20line%0A%7D%0A%0A%2F%2F%20Add%2Fremove%20calls%20to%20test%20your%20function.%0A%2F%2F%20Note%3A%20Only%20the%20last%20will%20display%0Acc%282%29%3B%20cc%283%29%3B%20cc%287%29%3B%20cc%28'K'%29%3B%20cc%28'A'%29%3B%0A" rel="nofollow">Counting Cards</a> has an issue.<br>
User Agent is: <code class="notranslate">Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36</code>.<br>
Please describe how to reproduce this issue, and include links to screenshots if possible.</p>
<p dir="auto">My code:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var count = 0;

function cc(card) {
  // Only change code below this line
  var bet = '';
  if(card&lt;=6){
    count ++;
  } else if (!(card&lt;=9)){
      count --;
  }
  bet = count &gt; 0? ' Bet':' Hold';
  return count + bet;
  // 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');
"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">count</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span>

<span class="pl-k">function</span> <span class="pl-en">cc</span><span class="pl-kos">(</span><span class="pl-s1">card</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-c">// Only change code below this line</span>
  <span class="pl-k">var</span> <span class="pl-s1">bet</span> <span class="pl-c1">=</span> <span class="pl-s">''</span><span class="pl-kos">;</span>
  <span class="pl-k">if</span><span class="pl-kos">(</span><span class="pl-s1">card</span><span class="pl-c1">&lt;=</span><span class="pl-c1">6</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
    <span class="pl-s1">count</span> <span class="pl-c1">++</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span> <span class="pl-k">else</span> <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-c1">!</span><span class="pl-kos">(</span><span class="pl-s1">card</span><span class="pl-c1">&lt;=</span><span class="pl-c1">9</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
      <span class="pl-s1">count</span> <span class="pl-c1">--</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
  <span class="pl-s1">bet</span> <span class="pl-c1">=</span> <span class="pl-s1">count</span> <span class="pl-c1">&gt;</span> <span class="pl-c1">0</span>? <span class="pl-s">' Bet'</span>:<span class="pl-s">' Hold'</span><span class="pl-kos">;</span>
  <span class="pl-k">return</span> <span class="pl-s1">count</span> <span class="pl-c1">+</span> <span class="pl-s1">bet</span><span class="pl-kos">;</span>
  <span class="pl-c">// Only change code above this line</span>
<span class="pl-kos">}</span>

<span class="pl-c">// Add/remove calls to test your function.</span>
<span class="pl-c">// Note: Only the last will display</span>
<span class="pl-en">cc</span><span class="pl-kos">(</span><span class="pl-c1">2</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-en">cc</span><span class="pl-kos">(</span><span class="pl-c1">3</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-en">cc</span><span class="pl-kos">(</span><span class="pl-c1">7</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-en">cc</span><span class="pl-kos">(</span><span class="pl-s">'K'</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-en">cc</span><span class="pl-kos">(</span><span class="pl-s">'A'</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h1 dir="auto">Ambiguity for what to do when <code class="notranslate">card</code> is 7, 8, or 9</h1>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/6234475/12858427/669845aa-cc0d-11e5-94ef-9e38c7503feb.png"><img src="https://cloud.githubusercontent.com/assets/6234475/12858427/669845aa-cc0d-11e5-94ef-9e38c7503feb.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">From this, campers seem pretty evenly split between thinking that <code class="notranslate">count</code> should be <em>reset</em> to <code class="notranslate">0</code> or simply <em>should not be changed</em>.<br>
The only test case is:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/6234475/12858472/a0075ce0-cc0d-11e5-9d33-b4b4602a0b0d.png"><img src="https://cloud.githubusercontent.com/assets/6234475/12858472/a0075ce0-cc0d-11e5-9d33-b4b4602a0b0d.png" alt="image" style="max-width: 100%;"></a><br>
Which will pass in either case.</p>
<p dir="auto">This means that you can accomplish the task regardless of how you interpret the instructions, but has been leading to some confusion for people asking for help.</p>