how to get the lasst element of an array javascript code example Example: javascript get last element in an array var last = arr.slice(-1)[0]