The toLowerCase function in JavaScript is utilized to transform a string into lowercase letters without altering the original string.
Syntax
The syntax for the toLowerCase method is as follows:
Example
string.toLowerCase()
Return
String in lowercase letter.
JavaScript String toLowerCase Method Example
Let's explore a few basic illustrations showcasing the implementation of the toLowerCase function.
Example 1
In this example, we will display the string using lowercase characters.
Example
<script>
var str = "Example";
document.writeln(str.toLowerCase());
</script>
Output:
Output
Example
Example 2
Here is another illustration demonstrating how to display a string in lowercase.
Example
<script>
var str = "Example tutorials";
document.writeln(str.toLowerCase());
</script>
Output:
Output
Example tutorials