By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,461 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,461 IT Pros & Developers. It's quick & easy.

How to turn objects into an array

P: 1

I have the following 3 objects:

Expand|Select|Wrap|Line Numbers
  1. {user1 : sum1, user2 : sum2, user3 : sum3}
  3. {user1 : prod1, user2 : prod2, user3 : prod3}
  5. {user1 : div1, user2 : div2, user3 : div3}

I cannot figure out how to obtain the following array:

Expand|Select|Wrap|Line Numbers
  1. [[user1, sum1, prod1, div1], [user2, sum2, prod2, div2], [user3, sum3, prod3, div3]]
I have to mention that I do not know the names: user1, user2, user3... I'm obtaining them dinamically.

Any ideas? Thanks.
Jun 6 '11 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 8,639
looks like something you can do with a for…in loop.
Jun 6 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.