nth()

Gets the value at the specified position in an array or an array-like object.

This function is valid in v2.2.0 to v2.24.3. This function has been downloaded 77 times.

Parameters

{Array|number} arrayOrN
If an array or an array-like object is given this will be the object from which the value will be immediately retrieved. If this is a number, this will be interpreted as opt_n, the position from which all values passed into the returned partial function will be retrieved.
{number} opt_n
If given and arrayOrN is an array or an array-like object, this will be the position from which the value should be retrieved. If this is a negative number the position will be calculated from the end of arr. If arrayOrN is a number this will become that value.

Returns

{Function|*}
If arrayOrN is an array or an array-like object the value at position n will be returned. Otherwise if arrayOrN is a number a partial function that will already have the value of opt_n and will be awaiting the array will be returned.

Requiring Functions

This function is directly required by the following functions:

  • first()
    Gets the last element in an array or an array-like object.
  • last()
    Gets the last element in an array or an array-like object.