Home  >  Article  >  Web Front-end  >  How to convert string to lowercase in javascript

How to convert string to lowercase in javascript

藏色散人
藏色散人Original
2021-07-10 14:15:076253browse

In JavaScript, you can use the toLowerCase method to convert a string to lowercase. The syntax is "stringObject.toLowerCase()". This method can be used to convert a string to lowercase.

How to convert string to lowercase in javascript

The operating environment of this article: windows7 system, javascript version 1.8.5, DELL G3 computer

How does javascript convert a string to lowercase?

toLowerCase() method;

Definition: The toLowerCase() method is used to convert a string to lowercase.

Syntax:

var str = "String";
str .toLowerCase();// string

toLowerCase() method is used to convert strings to lowercase.

toLowerCase() method introduction:

stringObject.toLowerCase()

Return value

A new string in which all uppercase characters of stringObject are converted to Lowercase characters.

Example

In this example, "Hello world!" will be displayed in lowercase letters:

<script type="text/javascript">
var str="Hello World!"
document.write(str.toLowerCase())
</script>

Recommended study: "javascript Advanced Tutorial

The above is the detailed content of How to convert 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