var fruit = [
{ fruit: "apple", color: "red" },
{ fruit: "orange", color: "orange" },
{ fruit: "cherry", color: "red" },
{ fruit: "grape", color: "green" },
{ fruit: "strawberry", color: "red" },
{ fruit: "lemon", color: "yellow" },
{ fruit: "peach", color: "yellow" },
{ fruit: "kiwi", color: "green" },
{ fruit: "lime", color: "green" }
];
fruit.sort(function(a, b){
var colora=a.color.toLowerCase(), colorb=b.color.toLowerCase()
if (colora < colorb)
return -1
if (colora > colorb)
return 1
return 0
})
console.log(fruit);
fruit.sort(function(a, b){
var fruita=a.fruit.toLowerCase(), fruitb=b.fruit.toLowerCase()
if (fruita < fruitb)
return -1
if (fruita > fruitb)
return 1
return 0
})
console.log(fruit);