Cannot get property of the object in JavaScript
<p>I have following code:</p>

<pre><code>     var userId = r.response[0].uid; 
     if (typeof ratings[userId] !== 'undefined'){
        ratings[userId].likes = ratings[userId].likes++;
        ratings[userId].name = r.response[0].first_name +" "+ r.response[0].last_name;
     } else {
        ratings[userId] = new Object;
        ratings[userId].likes = 1;                          
        ratings[userId].name = r.response[0].first_name +" "+ r.response[0].last_name; 
     }
</code></pre>

<p>So i Have strange thing. When I use console.log(ratings) to see what is in object, it shows me all properties of this object. But when I try to get any property like this:</p>

<pre><code> console.log(ratings[12345]) or console.log(ratings["12345"])
</code></pre>

<p>it is undefined. But <code>console.log(ratings)</code> said me that I have property 12345 (it is an object too).
What is wrong in my code and how can I fix it?</p>
