Heap Sort js