Home >Web Front-end >JS Tutorial >How to convert uppercase string to lowercase in javascript

How to convert uppercase string to lowercase in javascript

青灯夜游
青灯夜游Original
2021-06-18 16:54:433800browse

In JavaScript, you can use the toLowerCase() method to convert an uppercase string to lowercase. This method can convert all uppercase characters in the string to lowercase characters. The syntax format is "string.toLowerCase()" .

How to convert uppercase string to lowercase in javascript

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

In javascript, you can use the toLowerCase() function to convert uppercase strings to lowercase.

Let’s learn about it through an example:

var str="Hello World!"
console.log(str.toLowerCase());

Output:

How to convert uppercase string to lowercase in javascript

var str="HELLO WORLD!"
console.log(str.toLowerCase());

Output:

How to convert uppercase string to lowercase in javascript

Description:

toLowerCase() method is used to convert a string to lowercase. All uppercase characters in the string can be converted to Lowercase characters.

Syntax

stringObject.toLowerCase()

Return value

A new lowercase string.

[Related recommendations: javascript learning tutorial]

The above is the detailed content of How to convert uppercase string to lowercase in javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn