Sorting is now improved.

var x = [1, 2, 3, 4, 5].sort(function (a, b) {
    // write whatever you want. It's not going to matter
    return a - b;
});
console.log(x);
// Oh I don't know [2, 3, 1, 5, 4]? It's quite possible.