Last Updated On By Khizer Ali
toLowerCase() is a method of String class in JavaScript which is used to convert an String alphabets into uppercase alphabets. It will only convert alphabets. If a string contains any special case in it or numbers or anything else, this method will not affect them; they will be the same as in the original text. This method creates a new string instance, and it does not take any argument. There are many built-in methods in Javascript just like reverse string etc.
Table of Contents
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p id="demo"></p>
<script>
str = "Hello! Welcome to JavaScript."
document.getElementById("demo").innerHTML = str.toLowerCase();
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p id="demo"></p>
<script>
str = "[email protected]"
document.getElementById("demo").innerHTML = str.toLowerCase();
</script>
</body>
</html>
Read also: How to Use JavaScript += Operator?