Heap in js