We can also use the slice() method to get the last character of a string.
Since slice takes a string and returns a substring, we can pass in the string and start the slicing at -1, which will return the last character of the string.
This works because when you provide slice a negative number, it will start at the end of the string and work its way backwards.
Using the bracket notation
The final way you can get the last character of a string is to use the bracket notation.
Remember, because a string can be thought of as an array of characters, we can use the bracket notation to get the last character of a string by passing in the index of the last character.