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