The Wayback Machine - https://web.archive.org/web/20170626181016/https://github.com/lodash/lodash/blob/master/last.js
Skip to content
Permalink
6cb3460 Feb 6, 2017
19 lines (17 sloc) 369 Bytes
/**
* Gets the last element of `array`.
*
* @since 0.1.0
* @category Array
* @param {Array} array The array to query.
* @returns {*} Returns the last element of `array`.
* @example
*
* last([1, 2, 3])
* // => 3
*/
function last(array) {
const length = array == null ? 0 : array.length
return length ? array[length - 1] : undefined
}
export default last
You can't perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.