📅  最后修改于: 2022-03-11 15:01:49.161000             🧑  作者: Mango
var numbers = [3, 10, 9 , 6];
function compareNums(a, b){
return a - b;
}
numbers.sort(compareNums);
console.log(numbers); // outputs [3, 6, 9, 10]