JavaScript > Methods

Lower case in JavaScript

How to convert a string into lower case in JavaScript?


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

 <script>
        var txt = "HELLO FRIENDS!";
        document.write(txt.toLowerCase());
 </script>

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

In case there is a language conflict with the Unicode case mappings occur and toLowerCase doesn't give expected result, please use toLocaleLowerCase() function.

OUTPUT


 Views: 4835 | Post Order: 50



Write for us






Hosting Recommendations