I have an Array with decreasing even numbers:
var a = [20, 18, 10, 8, 6, 4, 2, 0]
When I call a.sort()
, it returns the following:
[0, 10, 18, 2, 20, 4, 6, 8]
This ordering is not correct. How can I sort in ascending order correctly?