peek()

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

On collections

Usage

  • peek()

Example

var array = [1, 2, 3];
array.peek();

Related

  • poke(value)

    Replaces the value at the beginning of a collection, the value that would be returned by shift().

  • peekBack()

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

  • shift()

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