【发布时间】:2012-03-25 08:47:39
【问题描述】:
我有一个关联数组存储在另一个关联数组中。我知道如何在常规数组中拼接特定值:
arr.splice(arr.indexOf('specific'), 1);
我想知道如何拼接这样的数组:
arr['hello']['world']
编辑这会缩短hello['world']['continent']
var hello = {};
hello['world'] = {};
hello['world']['continent'] = "country";
delete hello['world']['continent'];
alert(hello['world']['continent'])
【问题讨论】:
-
JavaScript 没有“关联”数组。
-
hello和world是什么?arr是什么样的?你希望它看起来像什么? -
arr['hello']['world']也可以通过arr.hello.world访问
标签: javascript arrays