nth

Array
since 4.11.0

Arguments

  • Array The array to query.
  • number The index of the element to return.

Returns

* the nth element of `array`.

Gets the element at index n of array. If n is negative, the nth element from the end is returned.

Example of Lodash _.nth

var array = ['a', 'b', 'c', 'd'];

_.nth(array, 1);
// => 'b'

_.nth(array, -2);
// => 'c';