JavaScript String toLowerCase() Method
The Javascript str.toLowerCase() method converts the entire string to lowercase. This method does not affect any of the special characters, digits, and the alphabet that are already in lowercase.
Syntax:
str.toLowerCase()
Return value: This method returns a new string in which all the upper-case letters are converted to lowercase.
Example 1: Below is an example of the String toLowerCase() Method.
JavaScript
<script> function func() { var str = 'GEEKSFORGEEKS' ; var string = str.toLowerCase(); console.log(string); } func(); </script> |
Output:
geeksforgeeks
Example 2: In this example, the method toLowerCase() converts all the upper case alphabets into lower case alphabets without affecting the special characters, digits, and all those characters that are already in the lower case.
JavaScript
<script> // JavaScript Program to illustrate // toLowerCase() method function func() { // Original string var str = 'It iS a Great Day.' ; // Converting to lower case var string = str.toLowerCase(); console.log(string); } func(); </script> |
Output:
it is a great day.
Example 3: In this example, the method toLowerCase() converts all the upper case alphabets into lower case alphabets without affecting the special characters, digits, and all those characters that are already in lower case.
JavaScript
<script> // JavaScript Program to illustrate // toLowerCase() method function func() { //Original string var str = 'It iS a 5r&e@@t Day.' ; //Converting to lower case var string = str.toLowerCase(); document.write(string); } func(); </script> |
Output:
it is a 5r&e@@t day.
We have a complete list of Javascript string methods, to check those please go through this Javascript String Complete reference article.
Supported Browser:
- Chrome 1 and above
- Edge 12 and above
- Firefox 1 and above
- Internet Explorer 3 and above
- Opera 3 and above
- Safari 1 and above
Please Login to comment...