JavaScript - Improving algorithm for finding square roots of perfect squares without Math.sqrt
<p>I'm trying to learn algorithms and coding stuff by scratch. I wrote a function that will find square roots of square numbers only, but I need to know how to improve its performance and possibly return square roots of non square numbers</p>

<pre><code>function squareroot(number) {
    var number;
    for (var i = number; i &gt;= 1; i--) {
        if (i * i === number) {
            number = i;
            break;
       }
   }
   return number;
}

 alert(squareroot(64))
</code></pre>

<p>Will return 8</p>

<p>Most importantly I need to know how to improve this performance. I don't really care about its limited functionality yet</p>