getting the last array item code example Example: javascript last element of array var last = arr.slice(-1)[0]