function sortHelper(a:int, b:int):int { if (a > b) return 1; else if (b < a) return -1; return 0; } [1, 2, 4, 3].sort(sortHelper);