Skip to content
Related Articles

Related Articles

JavaScript String toLowerCase() Method

Improve Article
Save Article
Like Article
  • Last Updated : 07 Oct, 2021

Below is the example of the String toLowerCase() Method. 
 

  • Example: 
     

JavaScript




<script>
function func() {
    var str = 'GEEKSFORGEEKS';
    var string = str.toLowerCase();
    document.write(string);
}
func();
</script>
  • Output: 
     
geeksforgeeks

str.toLowerCase() method converts the entire string to lower case. This method does not affect any of the special characters, digits, and the alphabets that are already in the lower case. 
Syntax: 
 

str.toLowerCase()

Return value: 
This method returns a new string in which all the upper case letters are converted to lower case.
Examples for the above method are provided below:
Example 1: 
 

var str = 'It iS a Great Day.';
var string = str.toLowerCase();
print(string);

Output: 
 

it is a great day.

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.
Example 2: 
 

var str = 'It iS a 5r&e@@t Day.';
var string = str.toLowerCase();
print(string);

Output: 
 

it is a 5r&e@@t day.

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.
Codes for the above method are provided below:
Program 1: 
 

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();
    document.write(string);
}
 
func();
</script>

Output: 
 

it is a great day.

Program 2: 
 

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.

 

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!