title: JQuery val returning undefined
body: <p>So I'm calling the following function:</p>
  
  <pre><code>function updateOutput(a){
  
      var n = $('#selector').val();
  
      $('#hueslide').val(a[n].hue);
      $('#huetext').val(a[n].hue);
  }
  </code></pre>
  
  <p>And I'm getting an error: "Cannot read property 'hue' of undefined." </p>
  
  <p>However, when I use console.log(n), it's returning a value. And when I manually insert the same value in a[n], I get the expected result. I'm guessing this is an asynchronous issue, but the same code was working in an earlier version and I'm not sure how to fix it.</p>
  
  <p>Specifically, when trying to debug  updateOutput using console.log, I get the following:</p>
  
  <pre><code>console.log(n); //returns 0
  console.log(a); //returns an array of objects
  console.log(a[0]); //returns first object in array
  console.log(a(n)); // returns undefined
  </code></pre>