Why is this returning differing results? Javascript
<p>Depending on where the <code>var roundedSqRt = Math.round(Math.sqrt(limit));</code> is, I get a different value as a result.</p>

<pre class="lang-js prettyprint-override"><code>function findRoundedSquareRoot(limit) {
  var roundedSqRt = Math.round(Math.sqrt(limit));
}

function findHighestPrimeFactor (limit, roundedSqRt) {
 var roundedSqRt = Math.round(Math.sqrt(limit));
  for(var i = roundedSqRt; i &gt;= 2; i--) {  
  if(limit % i == 0 &amp;&amp; findHighestPrimeFactor(i) == 1) {
    return i; 
    }
  }  
  return 1;  
}  

console.log(findHighestPrimeFactor(600851475143,775146));
</code></pre>

<p>When <code>var roundedSqRt</code> is used in <code>findRoundedSquareRoot</code>, the final result is incorrect;
When <code>var roundedSqRt</code> is used in <code>findHighestPrimeFactor</code>, the final result is correct.</p>

<p>Anyone have an idea why this is?</p>
