Using a Date as the hash table key
<p>How can I create a hash table object in JavaSript and use a date as the key? So far I've got this:</p>

<pre><code>var eventHash = {};
for (var i = 0, l = events.length; i &lt; l; i += 1) {
    eventHash[events[i].date.getTime()] = events[i];
}
</code></pre>

<p>And then when I want to find the event associated with today I would use this:</p>

<pre><code>var event = eventHash[(new Date(2011, 04, 26, 0, 0, 0, 0)).getTime()];
</code></pre>

<p>Can anyone see any pitfalls with this solution, or have any suggestions for improvement?</p>
