title: JS TypeError: Cannot read property 'map' of undefined
body: <p>I'm getting a <em>"Cannot read property of undefined"</em> error in the following code.</p>
  
  <p>What happens is that the <code>initFromServer()</code> is called which goes to get the model from the server.  But what ends up happening is that when <code>init()</code> is called, the parameter model is undefined. Using <code>console.log</code> to determine what is going on it seems that it never reaches the <code>Proxy.getModel()</code> function before it determines that model is undefined. </p>
  
  <p>I'm not entirely sure what is going on.  There are a lot of other functions and what not that I have not inserted.  Hopefully it makes sense.       </p>
  
  <pre><code>ClientModel.prototype.initFromServer = function(success) {
      this.getProxy().getModel(this.init(), success());
  }
  
  ClientModel.prototype.init = function(model) {  
      this.setMap(new catan.models.Map(model.map.radius));    
  };
  </code></pre>
  
  <p>In the proxy file we have:</p>
  
  <pre><code>Proxy.prototype.getModel = function(update, success) {
      jQuery.get("/game/model", function(data) {
                      update(data);
                      success(data);
      });
  };
  </code></pre>