title: How do I access properties of a javascript object if I don't know the names?
body: <p>Say you have a javascript object like this:</p>
  
  <pre><code>var data = { foo: 'bar', baz: 'quux' };
  </code></pre>
  
  <p>You can access the properties by the property name:</p>
  
  <pre><code>var foo = data.foo;
  var baz = data["baz"];
  </code></pre>
  
  <p>But is it possible to get these values if you don't know the name of the properties? Does the unordered nature of these properties make it impossible to tell them apart?</p>
  
  <p>In my case I'm thinking specifically of a situation where a function needs to accept a series of name-value pairs, but the names of the properties may change.</p>
  
  <p>My thoughts on how to do this so far is to pass the names of the properties to the function along with the data, but this feels like a hack. I would prefer to do this with introspection if possible.</p>