-1

Possible Duplicate:
javascript multidimensional array?

Hi guys I need to create an array that can be accessed like this:

var cssValue = cssArray[element][property][value];

Do you know how I could do this?

1
  • 2
    it seems more likely an object than a simple array Commented Sep 21, 2012 at 12:07

2 Answers 2

4

I would rather create an object instead of an array

var cssObject = {
   element : {
      property : {
         value : "your value"
      }
   }
}

since it seems that you may have some non-integer keys in your structure (property/value could be strings)

and you get the value with

 cssObject["element"]["property"]["value"] 
 // or cssObject.element.property.value
Sign up to request clarification or add additional context in comments.

Comments

1

This would be one simple way to do so:

var myarray = new Array(10);
for (i=0; i <10; i++){
myarray[10] = new Array();
}

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.