By using toLocaleLowerCase()
we can convert the string to lowercase letters.
<p>Click the below button to Convert.</p> <input type="button" value="Convert" onclick="Function()" /> <p id="myId"></p> <script> function Function() { var A = "TECHFUNDA"; var r = A.toLocaleLowerCase(); document.getElementById("myId").innerHTML = r; } </script>
In the above code snippet we have given Id
to the second <p>
element in the HTML code, there is a string in uppercase letters with variable A in the <script>
code. We need to convert the uppercase letters in a string to the lowercase letters, for that we use string method toLocaleLowerCase()
. Onclick of the button "Convert" fires the Function() in the <script>
code at the same time toLocaleLowerCase()
method converts the uppercase letters to the lowercase letters and gives the output.
This gives the same output as toLowerCase however where the language conflict with the Unicode case mappings occurs, we can use toLocaleLowerCase instead of toLowerCase.
OUTPUT
Views: 6817 | Post Order: 78