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.

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
Coursera
Pros
  • Professional service
  • Flexible timetables
  • A variety of features to choose from
Main Features
  • Professional certificates of completion
  • University-level courses
  • Multiple Online degree programs
Datacamp
Pros
  • Great user experience
  • Offers quality content
  • Very transparent with their pricing
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable

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

Latest Udacity Coupon Found:

Verified STAFF PICK

75% OFF COURSES

Udacity Black Friday Offer

The best time to save on Udacity courses is now - follow this coupon to access a 75% Udacity Black Friday discount & enjoy learning at a very low cost!

Expiration date: 03/03/2021
3176 People Used
Only 97 Left
Rating
5.0