nthElement
Returns the nth element of an array.
- Use
Array.prototype.slice()to get an array containing the nth element at the first place. - If the index is out of bounds, return
undefined. - Omit the second argument,
n, to get the first element of the array.