:
var myArrays = {
top : arrayTop,
left: arrayLeft,
right: arrayRight,
bottom: arrayBottom
}
, :
myArrays["top"][5] = 100;
- :
var myArrays = {
top : [],
left: [],
right: [],
bottom: []
}
4 , :
myArrays["top"][0] = 100;
myArrays.top[0] = 100;
, top, left, right bottom ( ), :
function MyObj(top, left, right, bottom) {
this.top = top;
this.left = left;
this.right = right;
this.bottom = bottom;
}
var myArray = [];
myArray.push(new MyObj(1,2,3,4));
console.log(myArray[0]);
myArray[0].left = 7;
console.log(myArray[0]);
http://jsfiddle.net/UNuF8/