Add tests and minor cleanup for javascript quick-sort