Sorting Algorithms implemented in JavaScript