aspose file tools*
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
Author

multivalue javascript variable

pooja jain
greenhorn
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.


:d
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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.

Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: multivalue javascript variable