pop()

Removes a value from the end of a collection, and returns that value.

For a SortedSet and a Heap, this is equivalent to removing the maximum value of the collection.

On collections

Usage

  • pop()

Examples

var array = [1, 2, 3];
array.pop();
array
var heap = new Heap([2, 8, 5]);
heap.pop();
heap.toArray();

Related

  • push(...values)

    Adds values to the end of a collection.

  • shift()

    Removes a value from the beginning of a collection, and returns that value.

  • peekBack()

    Returns the value at the end of a collection, the value that would be returned by pop().