let arr = [20, 40, 10, 50, 30]; arr.sort((a, b) => a - b); // [10, 20, 30, 40, 50]
let arr = [20, 40, 10, 50, 30]; arr.sort((a, b) => b - a); // [50, 40, 30, 20, 10]