javascriptで連想配列のソート

JavaScriptで連想配列をソートするには以下のようにします

$(function(){
//配列
var fruits = [
    {name:"Apple",amounts:200}
    ,{name:"Strawberry",amounts:300}
    ,{name:"Banana",amounts:100}
    ,{name:"Grape",amounts: 150}
];
//名前で配列をソート
station.sort(
    function(a,b){
        var aName = a["name"];
        var bName = b["name"];
        if( aName < bName ) return -1;
        if( aName > bName ) return 1;
        return 0;
    }
);
//数で配列をソート
station.sort(
    function(a,b){
        var aName = a["amounts"];
        var bName = b["amounts"];
        if( aName < bName ) return -1;
        if( aName > bName ) return 1;
        return 0;
    }
);