合并数组并对数组排序

原题:var a = [-3,-1,0,1,3,5,7,9], b = [-4,-2,0,2,3,4,5,6,7,8];
//返回一个合并过的数组[-4,-3,-2,-1,0,0,1,2,3,3,4,5,5,6,7,7,8,9]

    var a = [ -3, -1, 0, 1, 3, 5, 7, 9 ];
    var b = [ -4, -2, 0, 2, 3, 4, 5, 6, 7, 8 ];
    var c=a.concat(b);
    alert(c.sort());

 

posted @ 2016-04-08 20:43  绯乐  阅读(519)  评论(0编辑  收藏  举报