Home > Web Front-end > JS Tutorial > body text

How to convert string to lowercase in javascript

藏色散人
Release: 2023-01-07 11:42:46
Original
6264 people have browsed it

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
Copy after login

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

toLowerCase() method introduction:

stringObject.toLowerCase()
Copy after login

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template