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