Code has been added to clipboard!


Reading time 2 min
Published Sep 8, 2017
Updated Oct 2, 2019

JavaScript toLowerCase: Main Tips

  • This method is applied to convert all letters in a specified string in JavaScript lowercase.
  • The toLowerCase() method does not affect the original string. Instead, it generates a new modified string (with all lowercase letters).

toLowerCase() Method Explained

Even though JavaScript toLowerCase and toUpperCase perform opposite tasks, their functionality is very similar. For instance, they both retain digits and special symbols in the specified strings. Nevertheless, the JavaScript toLowerCase() function implements its task by replacing uppercase letters with lowercase ones.

Rather than modifying the letters in the original string, the JavaScript toLowerCase() creates a new changed string. Remember that the JavaScript lowercase function will decapitalize all letters in the string.

The example below shows how to properly use toLowerCase JavaScript function:

var str = "Hi, Mark!";
var res = str.toLowerCase();

Tip: the toUpperCase() method can be used for converting letters to uppercase.

Learn Proper Syntax

There is nothing complicated about the way JavaScript toLowerCase method needs to be written. The method is simplified to the point that you do not have to worry about arguments that need to be included in the parentheses. Why? Because the function does not have any parameters.

However, you should remember the correct capitalization. The example code below shows the way lowercase JavaScript function should look in your code:


Other Technical Details: Return Value

The JavaScript toLowerCase() function will generate a clear return value. It will show a string in which all uppercase letters are converted to lowercase. As we have mentioned before, the string will be new, and the capitalization of the original one will stay as it was.

Return Value: A string, which represents the original string with the letters all converted to lowercase.
JavaScript Version: ECMAScript 1

Web Development Course:

Web Development Course

Certificate Included
900h of content
For beginners