This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes multivalue javascript variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "multivalue javascript variable" Watch "multivalue javascript variable" New topic

multivalue javascript variable

pooja jain
Ranch Hand

Joined: Jan 12, 2005
Posts: 213
how to represent a multivalue variable?

for example, a 'box' which has three properties (attribute): id, weight and color.

should i go for array?

var box = new array(); = 1;
box.weight = 10;
box.color = red;

or any other better way to achieve this?

thanks in advance.

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
You should be using an object and not an array

You can also declare it like this

Do a search for JSON to get more information.

I agree. Here's the link:
subject: multivalue javascript variable
It's not a secret anymore!