I have an associative array:
var array1 = {
a1: {
id: "box1",
title: "box 1"
},
a2: {
id: "box2",
title: "box 2"
},
a3: {
id: "box3",
title: "box 3"
}
};
I then have another array which has references to the first array:
var array_order = ["a3:positionA", "a2:postitionB", "a1:positionC"];
I want to loop through the first list and then use the second list to find the position text
I am using jQuery so I have
$.each(array1, function(i,o) {
something in here where I can use i to find out what position. e.g. if a1 I would get positionC
}
array1variable is not an array. JavaScript only has one kind of arrays: good old zero-based numeric arrays such asarray_order.