title: jquery create array dynamically
body: <p>I have a page with 3 input fields. Of these fields I want to get the max value.
  What I'd like to achieve is that a user can fill in a field, the value of that field is dynamically added to an array, and also this value be displayed in a textfield if this value is greater than the value of the other two input fields.
  I'd like to be able to do this without the onBlur() function (if possible).
  Tried using the keyup function, but this will keep adding numbers to the array where only 3 numbers should be available..</p>
  
  <p>This is what I have so far:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
    $('#a').keyup(function() {
      var x = $('#a').val();
      hs.push(x);
    });
    $('#b').keyup(function() {
      var y = $('#b').val();
      hs.push(y);
    });
    $('#c').keyup(function() {
      var z = $('#c').val();
      hs.push(z);
    });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input id="a" type="text" /&gt;
  &lt;input id="b" type="text" /&gt;
  &lt;input id="c" type="text" /&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>If I enter 1 in a, 2 in b and 3 in c, then change my mind and change c from 3 to 33, I now have 4 numbers in my array (1,2,3,33), whereas I only want 3 (1,2,33)...</p>
  
  <p>I'm guessing the keyup function is not the way to go here, but would like to keep it as dynamical as possible without forcing the user to change focus from any of the inputs to get a result.</p>
  
  <p>Anyone have an idea how to do this, if even possible ?</p>