Check if a String is in Uppercase or Lowercase in JavaScript

Converting a string to uppercase or lowercase is straightforward using the toUpperCase() or toLowerCase() methods. But here we will see how to check if a String is all UpperCase or Lowercase using JavaScript.

Ways to check if a String is all Uppercase or Lowercase

  1. Using regular expression
  2. Using toUpperCase or toLowerCase methods

1. Using regular expression

The Regular Expression is the best way to determine whether a string is in uppercase or lowercase. Use the following code.

2. Using toUpperCase or toLowerCase methods

We can also use the predefined function toUpperCase() to check the string.

That’s it for today.
Thank you for reading. Happy Coding..!! 🙂

If you found value in this article,
you can support us by buying me a coffee! ☕

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *