Node.js examples for Array:Last Element
Get Last Array Element
function getLastArrayElement ( array ) { if ( array.length === 0 ) throw 'Error: trying to get last element of an empty array'; return array[ array.length - 1 ]; }