The toLowerCase() method returns a new string with letters converted to lowercase. It does not change the original string.
const text = "Welcome To Plus2net";
const lower = text.toLowerCase();
console.log(lower); // welcome to plus2net
string.toLowerCase()The method takes no arguments and returns a new string.
const original = "JavaScript";
const changed = original.toLowerCase();
console.log(original); // JavaScript
console.log(changed); // javascriptStrings are immutable, so store the returned value when you need the converted text.
Result:
const input = document.getElementById('lowerDemo');
input.addEventListener('input', () => {
result.textContent = input.value.toLowerCase();
});This modernizes the original onKeyUp demo while keeping the same teaching goal. See keyboard event handling.
const a = "JavaScript";
const b = "javascript";
console.log(a.toLowerCase() === b.toLowerCase()); // trueNormalizing both values is useful for simple case-insensitive comparisons.
const city = "İSTANBUL";
console.log(city.toLocaleLowerCase("tr"));For language-sensitive casing, consider toLocaleLowerCase().
Do not expect the original variable to change automatically, and do not use lowercase conversion as a substitute for full locale-aware collation or security normalization.
Previous / String Reference Next related topic
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.
| shreejith | 22-09-2010 |
| hey i have a difficultly that is i want to convert lowercase to uppercase and vice-verse without using tolowercase() or touppercase()..please help | |
| jango | 29-09-2015 |
| Thanks for the post. Is there a way I can convert to lower case without using the javascript method "toLowerCase()"? If there is, you post that. Thanks in advance | |