Javascript: Sorting Algos