How can I define a set of key/values in javascript and both lookup values and iterate the set in order?
<p>I have a set of key/values eg orange=123, banana=4, apple=567.  How can I store these key/values in a javascript object such that I can:</p>

<ol>
<li>Retrieve a value via lookup eg set["orange"] should return 123 and,</li>
<li>Iterate over the set <strong><em>in the order in which the key/value pairs were added</em></strong>.</li>
</ol>

<p>It seems that for 1. an object literal would be suitable but the iteration order is not guaranteed and that for 2. an array of key/value pairs (object literals) would provide an iteration order but not the ability to lookup the value based on a key.</p>

<p>@* Thanks for all the answers - Is this problem not a common one?  Do libraries like jQuery not include support for this kind of type?</p>
