<h4 dir="auto">Challenge Name</h4>

<p dir="auto">Diff Two Arrays</p>
<h4 dir="auto">Issue Description</h4>

<p dir="auto">Hi,<br>
I have a problem with the Diff Two Arrays challenge - my code seems to give the following expected results, however they're not accepted by some reason:<br>
[1, "calf", 3, "piglet", 7, "filly"]<br>
["diorite", "pink wool"]</p>
<p dir="auto">other results are accepted.</p>
<p dir="auto">Thanks in advance!</p>
<h4 dir="auto">Browser Information</h4>

<ul dir="auto">
<li>Browser Name, Version: Chrome, Internet Explorer</li>
<li>Operating System: Windows 7</li>
<li>Mobile, Desktop, or Tablet: desktop</li>
</ul>
<h4 dir="auto">Your Code</h4>

<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" var toRemove = [];

function diffArray(arr1, arr2) {
  var newArr = arr1.concat(arr2);

  for (var i = 0; i &lt; newArr.length; i++) {
    if (arr1.indexOf(newArr[i]) !== -1 &amp;&amp; arr2.indexOf(newArr[i]) !== -1) {
      toRemove.push(newArr[i]);
    }
  }

  // Same, same; but different.
  return newArr.filter(filterOutNewArr);
  //return toRemove;
}

function filterOutNewArr(value) {
  var pass = true;

  for (var i = 0; i &lt; toRemove.length; i++) {
    if (toRemove[i] == value) {
      pass = false;
    }
  }

  return pass;

}

diffArray([1, &quot;calf&quot;, 3, &quot;piglet&quot;], [7, &quot;filly&quot;]);
"><pre class="notranslate"> <span class="pl-k">var</span> <span class="pl-s1">toRemove</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">;</span>

<span class="pl-k">function</span> <span class="pl-en">diffArray</span><span class="pl-kos">(</span><span class="pl-s1">arr1</span><span class="pl-kos">,</span> <span class="pl-s1">arr2</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">var</span> <span class="pl-s1">newArr</span> <span class="pl-c1">=</span> <span class="pl-s1">arr1</span><span class="pl-kos">.</span><span class="pl-en">concat</span><span class="pl-kos">(</span><span class="pl-s1">arr2</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-k">for</span> <span class="pl-kos">(</span><span class="pl-k">var</span> <span class="pl-s1">i</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span> <span class="pl-s1">i</span> <span class="pl-c1">&lt;</span> <span class="pl-s1">newArr</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-kos">;</span> <span class="pl-s1">i</span><span class="pl-c1">++</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">arr1</span><span class="pl-kos">.</span><span class="pl-en">indexOf</span><span class="pl-kos">(</span><span class="pl-s1">newArr</span><span class="pl-kos">[</span><span class="pl-s1">i</span><span class="pl-kos">]</span><span class="pl-kos">)</span> <span class="pl-c1">!==</span> <span class="pl-c1">-</span><span class="pl-c1">1</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-s1">arr2</span><span class="pl-kos">.</span><span class="pl-en">indexOf</span><span class="pl-kos">(</span><span class="pl-s1">newArr</span><span class="pl-kos">[</span><span class="pl-s1">i</span><span class="pl-kos">]</span><span class="pl-kos">)</span> <span class="pl-c1">!==</span> <span class="pl-c1">-</span><span class="pl-c1">1</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
      <span class="pl-s1">toRemove</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-s1">newArr</span><span class="pl-kos">[</span><span class="pl-s1">i</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span>

  <span class="pl-c">// Same, same; but different.</span>
  <span class="pl-k">return</span> <span class="pl-s1">newArr</span><span class="pl-kos">.</span><span class="pl-en">filter</span><span class="pl-kos">(</span><span class="pl-s1">filterOutNewArr</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-c">//return toRemove;</span>
<span class="pl-kos">}</span>

<span class="pl-k">function</span> <span class="pl-en">filterOutNewArr</span><span class="pl-kos">(</span><span class="pl-s1">value</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">var</span> <span class="pl-s1">pass</span> <span class="pl-c1">=</span> <span class="pl-c1">true</span><span class="pl-kos">;</span>

  <span class="pl-k">for</span> <span class="pl-kos">(</span><span class="pl-k">var</span> <span class="pl-s1">i</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span> <span class="pl-s1">i</span> <span class="pl-c1">&lt;</span> <span class="pl-s1">toRemove</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-kos">;</span> <span class="pl-s1">i</span><span class="pl-c1">++</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">toRemove</span><span class="pl-kos">[</span><span class="pl-s1">i</span><span class="pl-kos">]</span> <span class="pl-c1">==</span> <span class="pl-s1">value</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
      <span class="pl-s1">pass</span> <span class="pl-c1">=</span> <span class="pl-c1">false</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span>

  <span class="pl-k">return</span> <span class="pl-s1">pass</span><span class="pl-kos">;</span>

<span class="pl-kos">}</span>

<span class="pl-en">diffArray</span><span class="pl-kos">(</span><span class="pl-kos">[</span><span class="pl-c1">1</span><span class="pl-kos">,</span> <span class="pl-s">"calf"</span><span class="pl-kos">,</span> <span class="pl-c1">3</span><span class="pl-kos">,</span> <span class="pl-s">"piglet"</span><span class="pl-kos">]</span><span class="pl-kos">,</span> <span class="pl-kos">[</span><span class="pl-c1">7</span><span class="pl-kos">,</span> <span class="pl-s">"filly"</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Challenge <a href="https://www.freecodecamp.com/challenges/factorialize-a-number#?solution=var%20count%3D1%3B%0Afunction%20factorialize%28num%29%20%7B%0A%20%20for%28var%20i%3D1%3B%20i%3C%3Dnum%3Bi%2B%2B%29%7B%0A%20%20%20%20%0A%20%20%20%20count%3D%20count%20*%20i%3B%0A%20%20%20%20%0A%20%20%7D%0A%20%20return%20count%3B%0A%20%20%0A%7D%0A%0Afactorialize%280%29%3B%0A" rel="nofollow">Factorialize a Number</a> has an issue.<br>
User Agent is: <code class="notranslate">Mozilla/5.0 (Windows NT 5.1; rv:47.0) Gecko/20100101 Firefox/47.0</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=1;
function factorialize(num) {
  for(var i=1; i&lt;=num;i++){

    count= count * i;

  }
  return count;

}

factorialize(0);
"><pre class="notranslate"><span class="pl-k">var</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">function</span> <span class="pl-en">factorialize</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">for</span><span class="pl-kos">(</span><span class="pl-k">var</span> <span class="pl-s1">i</span><span class="pl-c1">=</span><span class="pl-c1">1</span><span class="pl-kos">;</span> <span class="pl-s1">i</span><span class="pl-c1">&lt;=</span><span class="pl-s1">num</span><span class="pl-kos">;</span><span class="pl-s1">i</span><span class="pl-c1">++</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-s1">count</span> <span class="pl-c1">*</span> <span class="pl-s1">i</span><span class="pl-kos">;</span>

  <span class="pl-kos">}</span>
  <span class="pl-k">return</span> <span class="pl-s1">count</span><span class="pl-kos">;</span>

<span class="pl-kos">}</span>

<span class="pl-en">factorialize</span><span class="pl-kos">(</span><span class="pl-c1">0</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>