title: assigning an array value to a variable
body: <p>I came across a problem which I did manage to solve but I honestly do not understand how this works.</p>
  
  <pre><code>var array = [3, 6, 2, 56, 32, 5, 89, 32];
  var largest = 0;
  //My code
  for (var i = 0; i &lt; array.length; i++) {
      if (array[i] &gt; largest) {
          largest = array[i];
      }
  }
  
  console.log(largest);
  </code></pre>
  
  <p>How does my array assign a value to my variable within the if statement?  </p>
  
  <p>Why does this version not work?</p>
  
  <pre><code>array[i] = largest;
  </code></pre>
  
  <p>I'm very new to programming and I believe that understanding fundamental things as small as this can help many beginners become competent programmers. </p>