get last element of array dom javascript code example Example: js array last element get .slice(-1)[0]