title: how does modulus on a while loop executes?
body: <p>I need help understanding this solution for getting a prime factor. this is the code
  <a href="https://repl.it/CcgA" rel="nofollow">demo</a></p>
  
  <pre><code>function getMaxPrimeFactor (n) {
      var temp = n;
      for(var i = 2; i &lt; temp; i++) {
          while (temp % i === 0) {
              temp /= i;
          }
      }   
      console.log(temp);
  }
  
  getMaxPrimeFactor(13195);
  </code></pre>
  
  <p>I understand the for loop but I don't know what's going on the while loop and the division, how did it get an output of 29? </p>