title: Get property of object in JavaScript
body: <p>Basically I have a form with a <code>&lt;select&gt;</code> that chooses which set of data to use (values are "m", "f" and "c"). I then have a dictionary/object with the data in:</p>
  
  <pre><code>var gdas = {
      // Male
      "m": {
          "calories": 2500,
          "protein": 55,
          "carbohydrates": 300,
          "sugars": 120,
          "fat": 95,
          "saturates": 30,
          "fibre": 24,
          "salt": 6
      },
  
      // Female
      "f": {
          "calories": 2000,
          // etc.
  };
  </code></pre>
  
  <p>Now I need to get <code>gdas.m</code>/<code>gdas.f</code>/<code>gdas.c</code> but I'm not sure what syntax to use - I've tried:</p>
  
  <pre><code>var mode = $("#mode").val();
  var gda_set = gdas.mode;
  var gda_set = gdas[mode];
  </code></pre>
  
  <p>What's the right syntax/method for this?</p>