Value type stored in the heap.
Protected_Protected_Protected_Removes and returns the highest-priority value.
Highest-priority value, or undefined when the heap is empty.
Adds a value with its numeric priority.
Value to insert.
Numeric priority for ordering.
Reads the highest-priority value without removing it.
Highest-priority value, or undefined when the heap is empty.
Max-priority heap.
Remarks
Larger numeric priorities are popped before smaller priorities. Values with equal priorities are not guaranteed to preserve insertion order.
Example