Note that, this method does not affect any of the special characters, digits, and string characters that are already in lowercase.
The following syntax represents the string.toLowerCase() method:
Let’s take a look at the example:
How to convert a string to lowercase which is stored in an array?. You can see the following example:
In case, you pass the undefined string into toLowerCase() method and then you will get some error. The error looks like this: TypeError: Cannot read property ‘toLowerCase’ of undefined.
The following example:
let str = undefined let res = str.toLowerCase(); console.log(res) // TypeError: Cannot read property ‘toLowerCase’ of undefined.