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){
if (a.color < b.color){
return -1}
if (a.color > b.color){
return 1}
return 0
})
console.log(fruit);
fruit.sort(function(a, b){
if (a.fruit < b.fruit){
return -1}
if (a.fruit > b.fruit){
return 1}
return 0
})
console.log(fruit);