preDefinedArray = new Array(); preDefinedArray[0] = {value1:"predefined value 1", value2:"predefined value 2", value3:"predefined value 3"};
var theValue = preDefinedArray[0].value1; alert(theValue);
var theValue = changedValue; preDefinedArray[0].value1 = theValue; alert(preDefinedArray[0].value1);
dynamicallyDefinedArray = new Array(); function multiDimensionalArrayConstructor(d1, d2, d3) { this.value1 = d1; this.value2 = d2; this.value3 = d3; } function createArray(d1, d2, d3) { dynamicallyDefinedArray[dynamicallyDefinedArray.length] = new multiDimensionalArrayConstructor(d1, d2, d3); alert(dynamicallyDefinedArray[0].value1); }
function sortByValue1(a, b) { var x = a.value1.toLowerCase(); var y = b.value1.toLowerCase(); return ((x < y) ? -1 : ((x > y) ? 1 : 0)); } function performSort() { dynamicallyDefinedArray.sort(sortByValue1); }