title: "Uncaught TypeError: cannot read property 'length' of null" in jQuery
body: <p>I'm defining the following action to happen when pressing a button on my HTML:</p>
  
  <pre><code>$(document).ready(function() {
    $("#query").keydown(function () {
      // stuff
      $.get(url, function (result) {
      console.log(result);
  
      var list = "";
  
      for (var i = 0, l = result["results"].length; i &lt; l; i++) {
        list += '&lt;li&gt;' + result["results"][i]["label"] + '&lt;/li&gt;';
      }
  
      list = "Here are some results: &lt;ul&gt;" + list + "&lt;/ul&gt;";
  
    });
  });
  </code></pre>
  
  <p>What arrives in "result" is a JSON array in the following form:</p>
  
  <pre><code>{"results":[{"label":"something"},{"label":"something else"},{"label":"many other ones"}]}
  </code></pre>
  
  <p>So, why is my reference to <code>length</code> being interpreted as a reference to the property of a null value?</p>