📜  javascript 按数值排序 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:31.077000             🧑  作者: Mango

代码示例1
// Sort an array of numbers based on numerical value.
let numbers = [23, 65, 88, 12, 45, 99, 2000]

let sortednumbers = numbers.sort((a, b) => a - b);
//=> [12, 23, 45, 65, 88, 99, 2000]