toLowerCase method

The toLowerCase method converts characters of a string to lower case (makes small letters from capital letters). In doing so, we get a new string, while the original string remains unaffected.

Syntax

javascriptstring.toLowerCase();

Example

Let's convert all capital letters of a string to small letters:

javascriptlet str = 'ABCDE';
console.log(str.toLowerCase());

The code execution result:

javascript'abcde'

Example

By combining the toLowerCase method and the slice method, you can set lower case for individual parts of a string:

javascriptlet str = 'ABCDE';
let res = str.slice(0, 1) + str.slice(1).toLowerCase();

console.log(res);

The code execution result:

javascript'Abcde'

See also

  • the toUpperCase method
    that converts a string to uppercase
  • the charAt method
    that returns a character in a string