in this tutorial, We’ll convert a string to lowercase and uppercase. We’ll use toLowerCase()
and toUpperCase()
method to convert string into lowercase as well as in uppercase.
Convert to Lowercase
The toLowerCase() method converts a string to lowercase letters. This method does not change the original string.
Syntax:
string.toLowerCase()
The above method returns a converted string.
Convert String into Lowercase in JS
Let’s take a simple example to convert a string into lowercase using js.
let text = "JS-Tutorials.com!"; let result = text.toLowerCase();
Convert to Uppercase
The toUpperCase()
method converts a string to uppercase letters. This method does not change the original string.
Syntax:
string.toUpperCase()
The above method returns a converted string.
Convert String into Uppercase in JS
Let’s take a simple example to convert a string into the uppercase using js.
let text = "js-tutorials.com!"; let result = text.toUpperCase();