JavaScript toUpperCase() | Convert a String to Uppercase

The JavaScript toUpperCase() method converts specified string to uppercase. For example:

HTML with JavaScript Code
<!DOCTYPE html>
<html>
<body>

   <p id="xyz"></p>

   <script>
      let myString = "JavaScript is Fun. Is not it?";

      let myUpperString = myString.toUpperCase();
      document.getElementById("xyz").innerHTML = myUpperString;
   </script>
   
</body>
</html>
Output

That is, all the lowercase characters of specified string will be converted into its uppercase equivalent.

JavaScript toUpperCase() Syntax

The syntax of toUpperCase() method in JavaScript is:

string.toUpperCase()

The toUpperCase() method does not change the original string. Rather it returns a new string which is the exact copy of the original string, except that, all characters will be in uppercase.

JavaScript Online Test


« Previous Tutorial Next Tutorial »



Like/Share Us on Facebook 😋