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