quicksort algorithm in JavaScript