When working on a website and using Javascript, there may be so many instances where you would want to change the casing of a string to upper case.

Sometimes, you might want to convert a string to upper case and send the data to an API.

For example, let's say a user has submitted a form, but before saving the data to the database, you have to change the casing of the string to make sure the string is in uppercase.

This is just one use case when we need to change the casing of a string to upper case.

Javascript provides the toUpperCase method to us for this use.

Understanding the toUpperCase Method

The toUpperCase method in Javascript converts a string to all uppercase characters. This method does not take any parameters. This method returns a string that is in all uppercase characters.

Let's look at some code to see how we use the toUpperCase method.

const nameInMixedCasing = "CodE LiKE a deV";
const nameInUpperCase = nameInMixedCasing.toUpperCase();
// Result: "CODE LIKE A DEV"