javascript last element in array js code example
Example 1: last item in array javascript
// Find the last item in an array.
arrayName[arrayName.length - 1]
Example 2: javascript array last element
var lastEle = arr.slice(-1)[0];
// or
var lastEle = arr.slice(-1).pop();