//ascending order console.log([1, 2, 0, 1].sort((a, b) => a - b)) //descending order console.log([1, 2, 0, 1].sort((a, b) => b - a)) Run code snippetHide results