1 var baseNth = require('./_baseNth'),
2 toInteger = require('./toInteger');
5 * Gets the element at index `n` of `array`. If `n` is negative, the nth
6 * element from the end is returned.
12 * @param {Array} array The array to query.
13 * @param {number} [n=0] The index of the element to return.
14 * @returns {*} Returns the nth element of `array`.
17 * var array = ['a', 'b', 'c', 'd'];
25 function nth(array, n) {
26 return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;