How to loop a key/value object in javascript

Posted by Blankman on Stack Overflow See other posts from Stack Overflow or by Blankman
Published on 2010-06-02T14:51:44Z Indexed on 2010/06/02 15:14 UTC
Read the original article Hit count: 127

Filed under:

var user = {};

now I want to create a setUsers method that takes a key/value pair object and initializes the user variable.

setUsers = function(data) {

   // loop and init user

}

where data is like:

234: "john", 23421: "smith", ....

© Stack Overflow or respective owner

Related posts about JavaScript