js采用concat和sort将N个数组拼接起来的方法
<script type="text/javascript" > function concatAndSortArray(array1, array2) { if (arguments.length < 2) { return; } var arg = null; var array = []; for (var i = 0; i < arguments.length; i++) { arg = arguments[i]; if (typeof arg === "object" && arg.length > 0) { array = array.concat(arg); } } array.sort(function (arg1, arg2) { if (arg1 > arg2) { return 1; } else { return -1; } }); return array; } var array1 = [1, 2, 3, 4, 5, 15]; var array2 = [10, 12, 13, 25, 35]; var array = concatAndSortArray(array1, array2); console.log(array); </script>