my dog learned polymorphism
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
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
jQuery in Action, 3rd edition