get last element from an array javascript code example Example: get last element of array javascript arr.slice(-1)[0]