<p dir="auto">Challenge <a href="https://www.freecodecamp.com/challenges/find-the-longest-word-in-a-string#?solution=var%20arr%20%3D%20%5B%5D%3B%0Avar%20i%20%3D%200%3B%0Avar%20lengthArray%20%3D%20%5B%5D%3B%0A%0A%0Afunction%20findLongestWord(str)%20%7B%0A%20%20arr%20%3D%20str.split(%27%20%27)%3B%0A%20%20%0A%20%20for%20(i%20%3D%200%3B%20i%20%3C%2010%3B%20i%2B%2B)%20%7B%0A%20%20%20%20if%20(arr%5Bi%5D)%20%7B%0A%20%20%20%20%20%20lengthArray.push(arr%5Bi%5D.length)%3B%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20lengthArray.sort(function(a%2Cb)%20%7B%0A%20%20return%20b%20-%20a%3B%0A%7D)%3B%0A%20%20return%20lengthArray%5B0%5D%3B%0A%7D%0A%0AfindLongestWord(%22May%20the%20force%20be%20with%20you%22)%3B%0A" rel="nofollow">Find the Longest Word in a String</a> has an issue.<br>
User Agent is: <code class="notranslate">Mozilla/5.0 (Windows NT 10.0; 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>
<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 arr = [];
var i = 0;
var lengthArray = [];


function findLongestWord(str) {
  arr = str.split(' ');
  
  for (i = 0; i &lt; 10; i++) {
    if (arr[i]) {
      lengthArray.push(arr[i].length);
    }
  }
  lengthArray.sort(function(a,b) {
  return b - a;
});
  return lengthArray[0];
}

findLongestWord(&quot;May the force be with you&quot;);
"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">arr</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">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-k">var</span> <span class="pl-s1">lengthArray</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">findLongestWord</span><span class="pl-kos">(</span><span class="pl-s1">str</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-s1">arr</span> <span class="pl-c1">=</span> <span class="pl-s1">str</span><span class="pl-kos">.</span><span class="pl-en">split</span><span class="pl-kos">(</span><span class="pl-s">' '</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-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-c1">10</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">arr</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-s1">lengthArray</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-s1">arr</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">length</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span>
  <span class="pl-s1">lengthArray</span><span class="pl-kos">.</span><span class="pl-en">sort</span><span class="pl-kos">(</span><span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-s1">a</span><span class="pl-kos">,</span><span class="pl-s1">b</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">return</span> <span class="pl-s1">b</span> <span class="pl-c1">-</span> <span class="pl-s1">a</span><span class="pl-kos">;</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">lengthArray</span><span class="pl-kos">[</span><span class="pl-c1">0</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-en">findLongestWord</span><span class="pl-kos">(</span><span class="pl-s">"May the force be with you"</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>