js: in place merge sort