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