title: Js array returns always the highest value
body: <p>I have the following code:</p>
  
  <pre><code>var max_value = function(array) {
    var result = array[0];
  
    for (var i = 0; i &lt; array.length; i++) {
      if (array[i] &gt; result) {
        result = array[i];
      };
    }
    return result;
  }
  console.log(max_value([1, 10, 9]));
  </code></pre>
  
  <p>this returns 10 either like this:</p>
  
  <pre><code>console.log(max_value([1, 10, 9]));
  </code></pre>
  
  <p>or</p>
  
  <pre><code>console.log(max_value([10, 1, 9]));
  </code></pre>
  
  <p>if the condition is true should the last array number be returned? (9 in the last case, it seems like the highest number is returned) </p>