If you want to do it programatically then because JavaScript requires you to have this type of structure
tag_array = {};
tag_array['design1'] = {};
tag_array['design1']['0'] = [];
tag_array['design1']['0'][0] = {};
tag_array['design1']['0'][0]['x'] = 100;
you can make a prototype
function to create the object/array structure for you
Object.defineProperty(Object.prototype, 'addDimensions', { value: function(){
var prop = arguments[0];
if(this[prop] !== undefined){
if(typeof this[prop] !== 'object') throw 'Property "'+prop+'" is already defined.'
}else{
if(arguments.length > 1 && ~~arguments[1] === arguments[1] && arguments[1] >= 0) this[prop] = [];
else this[prop] = {};
}
if(arguments.length > 1){
this[arguments[0]].addDimensions.apply(
this[arguments[0]],
Array.prototype.slice.call(arguments,1)
);
}
return this;
},
enumerable: false });
and call it on an empty object {}
var myArrayLikeObject = ({}).addDimensions('design1','0',0); // {design1: [ [ {} ] ] }
or an array []
(only if first arg is an integer)
var myMultiArray = [].addDimensions(0,'hi',0); // [ {hi: [ {} ] } ]
or on an existing array or object
var a = [0,1,2];
a.addDimensions(3,0); // a = [0, 1, 2, [ {} ] ]