last.js 238 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 /** * Returns last element of array. */ function last(arr){ if (arr == null || arr.length < 1) { return undefined; } return arr[arr.length - 1]; } module.exports = last;