How to loop through items in a js object?

Posted by Blankman on Stack Overflow See other posts from Stack Overflow or by Blankman
Published on 2010-05-12T16:01:57Z Indexed on 2010/05/12 16:04 UTC
Read the original article Hit count: 374

Filed under:
|
|

how can I loop through these items?

var userCache = {};
userCache['john']     = {ID: 234, name: 'john', ... };
userCache['mary']     = {ID: 567, name: 'mary', ... };
userCache['douglas']  = {ID: 42,  name: 'douglas', ... };

the length property doesn't work?

userCache.length

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about loop