2

JavaScript String To Lowercase & Uppercase Example

 2 years ago
source link: https://www.js-tutorials.com/javascript-tutorial/javascript-string-to-lowercase-uppercase-example/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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();

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK