# 从小到大排序

# 解答

代码笔记 (opens new window)

let array = [9, 4, 3, 2, 1, 8, 3, 6, 7, 0, 1];

function sortNumber(a, b){
	return a - b
}

console.log(array);
console.log(array.sort(sortNumber));
1
2
3
4
5
6
7
8