quick sort in javascript