0

多次元の連想オブジェクトを作成する必要があり、部分的に機能しています。

簡易版:

var sources = {
    tales:  ['some content', 'some more content'],
    thehut: ['some content', 'some more content']
};

「一部のコンテンツ」と「その他のコンテンツ」にエイリアスを付けたいだけですが、正しく機能させることができません。

4

2 に答える 2

3

これはあなたが意味するものですか?

var sources = {
    tales:  {name1:'some content', name2:'some more content'},
    thehut: {name1:'some content', name2:'some more content'}
};
于 2013-03-07T13:55:49.653 に答える
1

「エイリアス」で何を指しているのかわかりませんが、これはあなたが望むものですか?

var sources =  {
    tales : {some_content: 'content 1', some_more_content: 'content 2'},
    thehut: {some_content: 'content 3', some_more_content: 'content 4'}
};

これを次のように使用します。

> sources.tales.some_content
  "content 1"
于 2013-03-07T13:57:59.357 に答える