How to Use the toLowerCase() method in JavaScript

  • 1 min read
  • November 3, 2020
linkedin twitter facebook reddit
linkedin twitter facebook reddit

JavaScript’s toLowerCase() method takes a string and converts it into a new string consisting of only lowercase letters.

Remember: JavaScript strings are immutable. This method will create a new string in memory, in addition to the old string.

Below is an example of how to use toLowerCase():

const str = 'Hello, I am Mark';
// Expected output: hello, i am mark

In the above example, const str had three capitalized letters. After applying the toLowerCase() method, all capital letters are converted to lowercase, as seen in the expected output.


The syntax of the toLowerCase() method is as follows:


Note: this method receives no parameters.

Lowercase letters are not affected, neither are digits nor special characters – these characters will be preserved in their original form. Only upper-case letters in the string will be affected.

Tip: You can use a similar method, toUpperrCase(), to capitalize all of the letters in a string.


Related Articles

JavaScript – How to Use setAttribute

JavaScript – Global Variable

JavaScript – Array to String


Related Posts

How to Change CSS Using JavaScript

How to Change CSS Using JavaScript

Cascading Style Sheets (CSS) is used to design the layout of a webpage. CSS is a set of structured rules describing the layout of elements in

How to Use the for…in Statement in JavaScript

How to Use the for…in Statement in JavaScript

The for…in statement is used to loop through an object’s properties. Basic for…in loop example The following code demonstrates a basic example using the for…in statement

How to use the for…of Statement in JavaScript

How to use the for…of Statement in JavaScript

The for…of statement was introduced in ECMAScript2015 (ES6) and adds a powerful new type of loop to JavaScript. JavaScript offers many different types of loops, each