wood burning stoves 2.0*
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();
box.id = 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: 15376
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.

Consider Paul's rocket mass heater.
subject: multivalue javascript variable
Similar Threads
Editable drop down combo box
Using a String variable as an object name in a loop...Possible??
Flickering JFrame images
variables in hashCode( ) and equals( )
c:set array session