People have the following situation:
var input1 = {preco:valor1.toFixed(3), tipo:name1};
var input2 = {preco:valor2.toFixed(3), tipo:name2};
var input3 = {preco:valor3.toFixed(3), tipo:name3};
var input4 = {preco:valor4.toFixed(3), tipo:name4};
and I would like to display the values of these 4 arrays in ascending order of 'price' as follows:
Lowest price: type: price Second lowest value: type2: preco2 (...)
How can I sort the 4 arrays according to the value of one of the objects in each of them?
EDIT to better exemplify:
var valor1 = 50;
var name1 = "nome1";
var valor2 = 20;
var name2 = "nome2";
var valor3 = 60;
var name3 = "nome3";
var valor4 = 10;
var name4 = "nome4";
var input1 = {preco:valor1.toFixed(3), tipo:name1};
var input2 = {preco:valor2.toFixed(3), tipo:name2};
var input3 = {preco:valor3.toFixed(3), tipo:name3};
var input4 = {preco:valor4.toFixed(3), tipo:name4};
and after sorting, in that case, you should print
Lowest Value: name4 - 10
Second Lowest Value: name2 - 20
Third Lower Value: name1 - 50
Room Minor Value: name3 - 60