Members
Methods
-
Remove all items from the queue.
-
Check whether this queue contains the specified item.
Name Type Description item
Object The item to search for. -
Dequeues an item. Returns undefined if the queue is empty.
Returns:
The the dequeued item. -
Enqueues the specified item.
Name Type Description item
Object The item to enqueue. -
Returns the item at the front of the queue. Returns undefined if the queue is empty.
Returns:
The item at the front of the queue. -
Sort the items in the queue in-place.
Name Type Description compareFunction
Queue~Comparator A function that defines the sort order.
Type Definitions
-
A function used to compare two items while sorting a queue.
Name Type Description a
Object An item in the array. b
Object An item in the array. Returns:
Returns a negative value ifa
is less thanb
, a positive value ifa
is greater thanb
, or 0 ifa
is equal tob
.Example:
function compareNumbers(a, b) { return a - b; }