check the last item in the list js code example Example: javascript last element of array arr.slice(-1)[0]