Brahim
Brahim

Reputation: 309

How to declare this kind of Structure in Javascript

I need to declare and insert elements in this type of structure which is required by the web service. So the input of my service like this:

data["A"]["12"]="word" (data)["String"]["String"]=(String)

i dont know if this called (HashList or MapList) I think it's not a Multi dimensional array becore is not indexed by 0,1....n How can i declare this type of structure?

Upvotes: 0

Views: 62

Answers (1)

CD..
CD..

Reputation: 74126

That's just an object:

var data = {
    A: {
        '12': 'word'
    }
}

Properties of JavaScript objects can be accessed or set using a bracket notation, just as in your example.

Working with Objects

Upvotes: 4

Related Questions