var fruits = [
      { 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" }
    ];

    function compare(a,b) {
      if (a.color < b.color)
        return -1;
      else if (a.color > b.color)
        return 1;
      else
        return 0;
    }
    fruits.sort();

    console.log("Color Sorting " + fruits);

    function compare(a,b) {
      if (a.fruit < b.fruit)
        return -1;
      else if (a.fruit > b.fruit)
        return 1;
      else
        return 0;
    }

    fruits.sort();

    console.log("Fruit Sorting " + fruits);