head first source npm

_.head(array)

Gets the first element of array.

Arguments

  1. array (Array)

    The array to query.

Returns (*)

Returns the first element of array.

Example

_.head([1, 2, 3]);
// => 1

_.head([]);
// => undefined