Greetings, I am currently facing an issue with sorting a specific object of arrays. The structure is as follows:
Allow me to provide a clearer example - I am receiving a string from an AJAX call formatted like this:
"name|price|blah|blah@name|price|blah|blah"
I am utilizing the split function to divide the string into two arrays using the delimiter @, and then further breaking them down by the | (pipe) separator. This results in the following:
As I iterate through each value in the arrays
for(z = 0; z < actualarr.length; z++) {
arr[1],
arr[2]
.....
}
["name", "price", "blah" "blah"],
["name", "price", "blah" "blah"],
["name", "price", "blah" "blah"],
["name", "price", "blah" "blah"],
["name", "price", "blah" "blah"],
["name", "price", "blah" "blah"]
The challenge lies in the fact that these arrays are nested within a loop, treating each array as an individual item. My objective is to arrange these items based on the value of "price" found at a specific index. Your assistance in solving this matter would be greatly appreciated. Thank you!