js quickest way to get last element of array code example Example: get last element of array javascript arr.slice(-1)[0]