JavaScript > Methods

Upper case in JavaScript

How to convert string into upper case in JavaScript?


In case we want to convert a string into the uppercase, we can use this approach.

 <script>
        var txt = "hello friends!";
        document.write(txt.toUpperCase());
 </script>

In the above code snippet, we have written “hello friends!” in small letters (Lower case) as variable text and in document.write we have called the text toUpperCase() method. This method convert the variable text which is written in lowercase into uppercase, that can be shown clearly in the below output.

OUTPUT

 Views: 744 | Post Order: 51



Write for us