last item js code example Example: javascript last element of array let arr = ['a', 'b', 'c'] arr.slice(-1)[0] // returns last element in an array