Question:

Describe and demonstrate the function of the toUpperCase and toLowerCase string methods.


The toUpperCase() and toLowerCase() string methods do what you expect them too. They take a string and will either return all uppercase or lowercase characters. Any non-alphabetical characters will remain unchanged. Don’t forget to include the end parentheses because thats how we call the methods.

See the Pen .toUpperCase() and .toLowerCase() by oscar (@nopity) on CodePen.

In the above codepen we use both methods. The first one we just upper case the whole string but the .toLowerCase we validate the text by first converting it to lower case then using a strict equal operator to compare the characters. That’s all we’re going to cover for this article as thats all there really is to it.