get the last element array javascript code example Example: get last element in array in javascript arr.slice(-1)[0]