Writing a program to find the maximum value in an array
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1669190/javascript-min-max-array-values">JavaScript: min &amp; max Array values?</a>  </p>
</blockquote>



<pre><code>var test = [-42, 0, 8];
var biggest=-Infinity;
for (i=0; i&lt;test.length;i++)
{if (test[i]&gt;biggest)
    alert('It is!');
  biggest = test[i];
 else
     alert("It isn't!");}
alert("The biggest element is:" + biggest);
</code></pre>

<p>I'm trying to write a program to find the biggest number in an array but my code is not working. Any help please?</p>
