array-nth-last
Tiny function to get nth last entry from array
Install
$ yarn add array-nth-last
or
$ npm install array-nth-last --save
Usage
const last = ; const arr = 1 2 3 4 5; ; // => 5; // => 2
API
last(array, n?)
Returns the nth last entry from the array
array
Type: Array
The array from which to get the nth entry
n? optional
Type: number
The desired entry of the array to return