last elemetn of arry in javascript code example
Example 1: javascript last element of array
arr.slice(-1)[0]
Example 2: last item in array javascript
// Find the last item in an array.
arrayName[arrayName.length - 1]
arr.slice(-1)[0]
// Find the last item in an array.
arrayName[arrayName.length - 1]