title: Javascript object: How to return property using value?
body: <p>Given a Javascript object, I wonder whether there is a way to use value to return the corresponding property? I understand properties have to be unique, but values can duplicate. So perhaps a way to use value to return the first matching property?</p>
  
  <pre><code>var x = { a: 1, b: 2, c: 3, d: 4, e: 4 };
  </code></pre>
  
  <p>Want to use value <code>4</code> to access property <code>d</code>. </p>
  
  <p><strong>UPDATE</strong>: Thanks for the helpful responses. I just realized my question may not be a good one, as object (from Javascript) or hash (from Ruby) is really an unordered list, so asking for the "first matching" is not quite sound.</p>