🚨 Time is Running Out: Reserve Your Spot in the Lucky Draw & Claim Rewards! START NOW

Code has been added to clipboard!

toLowerCase

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:

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

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

DataCamp
Pros
  • Easy to use with a learn-by-doing approach
  • Offers quality content
  • Gamified in-browser coding experience
  • The price matches the quality
  • Suitable for learners ranging from beginner to advanced
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable
Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid Certificates of completion
Udemy
Pros
  • Easy to navigate
  • No technical issues
  • Seems to care about its users
Main Features
  • Huge variety of courses
  • 30-day refund policy
  • Free certificates of completion

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:

string.toLowerCase()

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