Below is an example of how to use toLowerCase():
const str = 'Hello, I am Mark'; console.log(str.toLowerCase()); // 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.