<p dir="auto">Challenge <a href="http://www.freecodecamp.com/challenges/bonfire-truncate-a-string#?solution=function%20truncate%28str%2C%20num%29%20%7B%0A%20%20if%20%28str.length%20%3C%3D%203%29%20%7B%0A%20%20%20%20str%20%3D%20str.slice%280%2Cnum%29.concat%28%22..%22%29%3B%0A%20%20%7D%0A%20%20if%20%28str.length%20%3E%20num%29%20%7B%0A%20%20%20%20str%20%3D%20str.slice%280%2Cnum-3%29.concat%28%22...%22%29%3B%0A%20%20%7D%0A%20%20%2F%2F%20Clear%20out%20that%20junk%20in%20your%20trunk%0A%20%20return%20str%3B%0A%7D%0A%0Atruncate%28%22A-1%22%2C%202%29%3B%0A" rel="nofollow">Bonfire: Truncate a string</a> has an issue.<br>
User Agent is: <code class="notranslate">Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 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="function truncate(str, num) {
  if (str.length &lt;= 3) {
    str = str.slice(0,num).concat(&quot;..&quot;);
  }
  if (str.length &gt; num) {
    str = str.slice(0,num-3).concat(&quot;...&quot;);
  }
  // Clear out that junk in your trunk
  return str;
}

truncate(&quot;A-1&quot;, 2);
"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">truncate</span><span class="pl-kos">(</span><span class="pl-s1">str</span><span class="pl-kos">,</span> <span class="pl-s1">num</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">str</span><span class="pl-kos">.</span><span class="pl-c1">length</span> <span class="pl-c1">&lt;=</span> <span class="pl-c1">3</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-s1">str</span> <span class="pl-c1">=</span> <span class="pl-s1">str</span><span class="pl-kos">.</span><span class="pl-en">slice</span><span class="pl-kos">(</span><span class="pl-c1">0</span><span class="pl-kos">,</span><span class="pl-s1">num</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">concat</span><span class="pl-kos">(</span><span class="pl-s">".."</span><span class="pl-kos">)</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">str</span><span class="pl-kos">.</span><span class="pl-c1">length</span> <span class="pl-c1">&gt;</span> <span class="pl-s1">num</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-s1">str</span> <span class="pl-c1">=</span> <span class="pl-s1">str</span><span class="pl-kos">.</span><span class="pl-en">slice</span><span class="pl-kos">(</span><span class="pl-c1">0</span><span class="pl-kos">,</span><span class="pl-s1">num</span><span class="pl-c1">-</span><span class="pl-c1">3</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">concat</span><span class="pl-kos">(</span><span class="pl-s">"..."</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
  <span class="pl-c">// Clear out that junk in your trunk</span>
  <span class="pl-k">return</span> <span class="pl-s1">str</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-en">truncate</span><span class="pl-kos">(</span><span class="pl-s">"A-1"</span><span class="pl-kos">,</span> <span class="pl-c1">2</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Hi! This code passes when it shouldn't. The challenge asks for users to truncate if str.length is longer than num.length, but this configuration truncates str as long as it is shorter than 3 characters, regardless of the length of num. This could be resolved by making another test parameter truncate("A-", 2) which does not truncate.</p>
<p dir="auto">Challenge <a href="http://beta.freecodecamp.com/en/challenges/basic-css/change-the-color-of-text" rel="nofollow">change-the-color-of-text</a> has an issue.<br>
User Agent is: <code class="notranslate">Mozilla/5.0 (Windows NT 6.3; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0</code>.<br>
Please describe how to reproduce this issue, and include links to screenshots if possible.</p>
<div class="highlight highlight-text-html-basic notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
&lt;h2 style=&quot;color: red&quot;&gt;CatPhotoApp&lt;/h2&gt;

&lt;p&gt;Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.&lt;/p&gt;
"><pre class="notranslate"><span class="pl-kos">&lt;</span><span class="pl-ent">h2</span> <span class="pl-c1">style</span>="<span class="pl-s">color: red</span>"<span class="pl-kos">&gt;</span>CatPhotoApp<span class="pl-kos">&lt;/</span><span class="pl-ent">h2</span><span class="pl-kos">&gt;</span>

<span class="pl-kos">&lt;</span><span class="pl-ent">p</span><span class="pl-kos">&gt;</span>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.<span class="pl-kos">&lt;/</span><span class="pl-ent">p</span><span class="pl-kos">&gt;</span></pre></div>