JavaScript toLocaleLowerCase()
The toLocaleLowerCase()
method in JavaScript is used to convert a string to lowercase letters based on the host's current locale. This method does not change the original string, but it returns a new string.
Syntax
The syntax for using the toLocaleLowerCase()
method is as follows:
string.toLocaleLowerCase([locale])
Here, string
is the string to be converted, and locale
is an optional parameter that specifies the locale to use.
Example
The following example demonstrates how to use the toLocaleLowerCase()
method in JavaScript:
let str = 'HELLO WORLD';
console.log(str.toLocaleLowerCase()); // Output: hello world
In this example, the toLocaleLowerCase()
method is used to convert the str
variable to lowercase.
Output
The output of the above example would be:
hello world