1
javascript uses alphanumeric to sort by default. Therefore, the result of [1,2,5,10] .sort () is [1, 10, 2, 5]. If you want to sort correctly, you should do this: [1,2,5,10] .sort ((a, b) => a-b)
javascript uses alphanumeric to sort by default. So the result of [1,2,5,10] .sort () is [1, 10, 2, 5].