I have a multi-dimensional array in javascript defined as :-
myArray[0][0] = Some IMage;
myArray[0][1] = Some price;
myArray[0][2] = Some name;
myArray[0][3] = Some values;
myArray[0][4] = Some otherValues;
myArray[1][0] = Some IMage;
myArray[1][1] = Some price;
myArray[1][2] = Some name;
myArray[1][3] = Some values;
myArray[1][4] = Some otherValues;
Now my job is to sort them according to the price . How can this be done ?
var arr = []; arr.push({ img: '', price: 99, name: 'Name', values: 123, otherValues: 987 });Let's say you pushed multiple objects into this array. Then you can access the first object's price byarr[0].priceand the second byarr[1].price.myArray[0]andmyArray[1]. Do you want each array sorted separately? Do you want all price values sorted together and then replaced with the first 5 values in one array and the last 5 values in the second array? How do you want it sorted? We can't answer the question without knowing this.