Checking length of dictionary object [duplicate]

I'm trying to check the length here. Tried count. Is there something I'm missing?

var dNames = {}; 
dNames = GetAllNames();

for (var i = 0, l = dName.length; i < l; i++) 
        alert("Name: " + dName[i].name);

dNames holds name/value pairs. I know that dNames has values in that object but it's still completely skipping over that and when I alert out even dName.length obviously that's not how to do not sure. Looked it up on the web. Could not find anything on this.


What I do is use Object.keys() to return a list of all the keys and then get the length of that