strange behaviour with javascript map/object
<p>I am using javascript map to store keys and values. Later on I check if specified key is present in map or not, but it sometimes gives correct result but sometimes it don't. I tried to print the map using <code>console.log(mapname)</code>, it shows all keys, but if I try to check if some specified key is present - sometimes it gives wrong answer.</p>

<p>Am using following code:</p>

<pre><code>// following code is called n times in loop with different/same vales of x
myMap : new Object();
var key = x  ; // populated dynamically actually
myMap[key] = "dummyval";
if(myIdMap[document.getElementById("abc").value.trim()] != null)
    alert('present');
else
    alert('not present');
</code></pre>

<p>What can be the possible problem? Can alphanumericstring/integers values can be used as keys?</p>
