JavaScript - toLocaleLowerCase() method

revision:


Category : string

The toLocaleLowerCase() method converts a string to lowercase letters, using current locale. The locale is based on the language settings of the browser. The method does not change the original string. It returns the same result as toLowerCase(), except for locales that conflict with the regular Unicode case mappings (such as Turkish).

Syntax :

        string.toLocaleLowerCase()  
    

Parameters: none

Examples:

            <p>toLocaleLowerCase() converts a string to lowercase letters, using current locale:</p>
            <p id="demo"></p>
            <script>
                let text = "Hello World!";
                let result = text.toLocaleLowerCase();
                document.getElementById("demo").innerHTML = result;
            </script>
        

Practical examples

example: using locales and options.

code:
                    <div>
                        <p id="local-1"></p>
                        <p id="local-2"></p>
                    </div>
                    <script>
                    let text = "Hello World!";
                    document.getElementById("local-1").innerHTML = "text : " + text;
                    let result = text.toLocaleLowerCase();
                    document.getElementById("local-2").innerHTML = "text to lower case : " + result;
            
                    </script>