title: Finding largest integer in an array in JavaScript
body: <blockquote>
  <p><strong>Possible Duplicate:</strong> <br/>
  <a href="https://stackoverflow.com/questions/1379553/how-might-i-find-the-largest-number-contained-in-a-javascript-array">How might I find the largest number contained in a JavaScript array?</a></p>
  </blockquote>
  
  <p>I am having trouble getting this code to work. I have been at it for a while trying to figure it out. When I look at the console it just displays 0. What did I do wrong?</p>
  <p>Here is my code:</p>
  <pre><code>var array = [3 , 6, 2, 56, 32, 5, 89, 32];
  var largest= 0;
  
  for (i=0; i&lt;=largest;i++){
      if (array&gt;largest) {
          var largest=array[i];
      }
  }
  
  console.log(largest);
  </code></pre>