Convert a String to Lowercase and Uppercase with JavaScript | Plantpot

Convert a String to Lowercase and Uppercase with JavaScript

Web Dev
Sponsored links

In this article, I will introduce how to convert a string to lowercase and uppercase with JavaScript.

Convert a string to lowercase

Use the toLowerCase() method to convert the string to lowercase.

Below is a sample.

let str = "Lorem ipsum dolor sit amet";
console.log(str.toLowerCase());

//result
//"lorem ipsum dolor sit amet"
Sponsored links

Convert a string to uppercase

Use the toUpperCase() method to convert a string to uppercase.

Below is a sample.

let str = "Lorem ipsum dolor sit amet";
console.log(str.toUpperCase());

//result
//"LOREM IPSUM DOLOR SIT AMET"