[英]3D array JavaScript
I need a 3D array like a runes['red'][0]['test'] 我需要3D数组,如符文['red'] [0] ['test']
How I can do it? 我该怎么办?
var runes = {}
runes['red'] = [
'test': ['loh']
]
runes['blue'] = {}
runes['yellow'] = {}
Thanks in advance. 提前致谢。
So you want an object containing an array with objects inside it? 因此,您想要一个包含内部包含对象的数组的对象吗? That would look like this:
看起来像这样:
runes["red"] = [
{test: "loh"},
{anotherTest: "anotherLoh"}
]
var runes = {}; // Object
runes.red = [ // containing Array of Objects
{'test': 'loh'}, // 0
{'test': 'blah'}, // 1
{property1: "value", property2: "value"} // 2...
];
alert( runes.red[0].test ); // loh
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.