Languages
[Edit]
EN

JavaScript - convert string to lowercase

12 points
Created by:
Reilly-Collier
650

In this article, we would like to show you how to convert strings to lower case in JavaScript.

The string class contains two methods that help to make the conversion to lower case. One of them allows making conversion by taking into account locale. To see practical usage of methods look at the below examples.

1. Built-in conversion approach example

With this approach, it is possible to convert any string to lower case.

// ONLINE-RUNNER:browser;

var text = 'Hi! How are you?';
var convertedText = text.toLowerCase();

console.log(convertedText);

2. Built-in conversion approach with locale example

This section shows how to convert any string to lower case taking into account locale. In almost all cases it produces a similar output string to the version without locale.

// ONLINE-RUNNER:browser;

var text = 'Здравствуй! Как поживаете?';

var convertedText = text.toLocaleLowerCase();
//var convertedText = text.toLocaleLowerCase('ru-RU');
//var convertedText = text.toLocaleLowerCase(['ru-RU', 'en-US']);

console.log(convertedText);

 

Alternative titles

  1. JavaScript - how to convert string to lower case?
  2. JavaScript - how to change string to small letters?
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

JavaScript - string conversion

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join