get last araay in array code example
Example 1: javascript last element of array
let arr = ['a', 'b', 'c']
arr.slice(-1)[0] // returns last element in an array
Example 2: get last element in array in javascript
arr.slice(-1)[0]
let arr = ['a', 'b', 'c']
arr.slice(-1)[0] // returns last element in an array
arr.slice(-1)[0]