Tenga en cuenta que la sustitución Array() es clave en este caso con los desaparecidos ')'
var array1 = {};
array1['one'] = new Object();
array1['one']['data'] = 'some text';
array1['one']['two'] = new Object();
array1['one']['two']['three'] = new Object();
array1['one']['two']['three']['data'] = 'some other text';
$.each(array1, function(key1, value1) {
$.each(value1['two']['three'], function(key1, value1) {
document.write('test');
});
});
y Otra manera de escribir lo mismo: (pequeña tweek en la escritura para hacer referencia a su objeto)
var array1 = {};
array1.one = new Object();
array1.one.data = 'some text';
array1.one.two = new Object();
array1.one.two.three = new Object();
array1.one.two.three.data = 'some other text';
$.each(array1, function(key1, value1) {
$.each(value1['two']['three'], function(key1, value1) {
document.write('test' + array1.one.data);
});
});
Y, por último, con el desuso new Object() de reemplazo:
var array1 = {};
array1['one'] = {}
array1['one']['data'] = 'some text';
array1['one']['two'] = {};
array1['one']['two']['three'] = {};
array1['one']['two']['three']['data'] = 'some other text';
$.each(array1, function(key1, value1) {
$.each(value1['two']['three'], function(key1, value1) {
document.write('test');
});
});
EDIT: cierto ingenio divertido h la matriz, y por qué es posible que tenga las cuerdas en la declaración objeto como lo tienes:
var array1 = {};
var fun="four";
array1.one = {};
array1.one.data = 'some text';
array1.one.two = {};
array1.one.two.three = {};
array1.one.two.three.data = 'some other text';
array1.one.two[fun] = {};
array1.one.two[fun].data=' howdy';
$.each(array1, function(key1, value1) {
$.each(value1.two.three, function(key1, value1) {
document.write('test'+array1.one.two[fun].data+ ":"+key1+":"+value1);
});
});
la salida del último es: "prueba Howdy: los datos: un texto diferente"
Esos son * * no ** Matrices que está utilizando allí, pero objetos normales. No use 'new Array()' pero 'new Object()' (o simplemente '{}' para un objeto "empty"). – RoToRa