title: How to put object in a HashMap in js?
body: <p>I create Simple <code>HashMap</code> like this , but When I put an <code>object</code> into this map as a <code>value</code>, I can't call <code>object's function</code> when I get it from map , I find that the <code>object</code> was convert to <code>string</code> by <code>toString</code> function. So what should I do to put the <code>object itself</code> rather than a string into map?</p>
  
  <pre><code>var g_itemMap =
  {
      put : function(key,value){this[key] = value},
      get : function(key){return this[key]},
      contains : function(key){return this.get(key) == null?false:true},
      remove : function(key){delete this[key]}
  }
  </code></pre>
  
  <p>I put the object like this:</p>
  
  <pre><code>g_itemMap.put(1, object);
  </code></pre>
  
  <p>And get it:</p>
  
  <pre><code>var object = g_itemMap.get(1);
  </code></pre>
  
  <p>When I call it's function , it went wrong:</p>
  
  <pre><code>object.somefunction();
  </code></pre>
  
  <p>alert can display object:</p>
  
  <pre><code>[object BitmapItem]
  </code></pre>